在我的项目构建中,我已经替换了每一个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'

其他回答

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

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

仅仅更新谷歌服务版本对我来说不起作用。

首先,确保所有的依赖编译都替换为实现。 更新项目中的所有依赖项。因为如果你的一个依赖项正在编译,那么你的项目就会显示这个错误。所以更新所有依赖项版本。

在我的情况下,这是由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'
  }
}

我尝试了这里提到的所有解决方案,但运气不佳。 我在我的身材里发现的。Gradle文件如下:

dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }

我只是将其更改为如下所示并保存并尝试构建成功。

dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
    }