在我的项目构建中,我已经替换了每一个compile by implementation的出现。gradle,但是我仍然得到这个警告:

我试图在整个项目中寻找“compile”,但没有找到匹配。那么原因是什么呢?


当前回答

谷歌于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'

其他回答

只需从构建中添加。从构建脚本Gradle

classpath 'com.google.gms:google-services:3.2.0'

所有依赖项“compile”替换为“implementation”。

这对我很管用。

在我的例子中,它是一个使用compile来实现传递依赖的旧依赖:com.jakewharton.hugo

将它从我的gradle中删除后,它编译了。

https://issuetracker.google.com/issues/72479188表示插件有时会引入“编译”依赖项,这就是触发警告的原因。可能只是最简单的星号问题,并等待,直到他们修复它,指出哪些插件导致的问题。

回到你的位置。在项目级别的Gradle文件中,您会发现以下行突出显示

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'  //place your cursor over here 
    //and hit alt+enter and it will show you the appropriate version to select


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files

    classpath 'com.google.gms:google-services:4.0.2' //the same as previously
}

我已经更新了com.google。Gms:google-services从3.1.1升级到3.2.0,警告停止出现。

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.1.0")

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    
    classpath("com.google.gms:google-services:3.2.0")
    }
}