在我的项目构建中,我已经替换了每一个compile by implementation的出现。gradle,但是我仍然得到这个警告:
我试图在整个项目中寻找“compile”,但没有找到匹配。那么原因是什么呢?
在我的项目构建中,我已经替换了每一个compile by implementation的出现。gradle,但是我仍然得到这个警告:
我试图在整个项目中寻找“compile”,但没有找到匹配。那么原因是什么呢?
当前回答
对我来说,将编译改为实现可以解决这个问题
之前
compile 'androidx.recyclerview:recyclerview:1.0.0'
compile 'androidx.cardview:cardview:1.0.0'
//Retrofit Dependencies
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
后
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
//Retrofit Dependencies
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
其他回答
使用当前最新版本的谷歌gms服务为我解决了这个问题。
在项目级别build.gradle:
buildscript {
...
dependencies {
classpath 'com.google.gms:google-services:3.2.1'
...
}
}
在我的情况下,问题是谷歌服务gradle插件与以下一行在gradle文件:
应用插件:'com.google.gms.google-services'
删除这个就解决了这个问题
我尝试了这里提到的所有解决方案,但运气不佳。 我在我的身材里发现的。Gradle文件如下:
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
我只是将其更改为如下所示并保存并尝试构建成功。
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
当前版本为4.2.0:
构建脚本 {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0'
}
}
谷歌于2021年9月更新了其服务。给更新,我面临同样的问题,然后我更新构建。android studio中的Gradle文件
旧版本有问题
classpath 'com.google.gms:google-services:4.3.3'
更新了build.gradle中的代码
classpath 'com.google.gms:google-services:4.3.10'