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

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


当前回答

回复谷歌:https://issuetracker.google.com/issues/74048134

会有一些依赖仍然使用编译,仔细检查你的应用程序依赖和传递依赖。

其他回答

当前版本为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'
}

}

对我来说,将编译改为实现可以解决这个问题

之前

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'
        ...  
    }
}

在我的情况下,这是由Realm库引起的,在我将它更新到Realm的最新版本(目前为止为5.1.0)后,问题解决了!

下面是gradle的工作脚本:

buildscript {
repositories {
    jcenter()
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath "io.realm:realm-gradle-plugin:5.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.1'
  }
}

不需要拆线。正如Jkrevis所写的,更新com.google。Gms:google-services升级到3.2.0并停止警告。