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

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


当前回答

对我来说,解决这个问题的变通方法是我使用了一个旧版本的Gradle,可以在这里找到:

我使用的是gradle-3.0-rc-1-src版本,但其他版本也可以,尽管它可能不会比3.0版本更新。

首先将压缩文件解压到您喜欢的任何地方。

然后进入文件->设置->构建,执行,部署-> Gradle,并将设置更改为使用本地Gradle分布。在此之后,确保Gradle home字段指向刚刚解压到的目录中的. Gradle目录。

重新构建项目,一切都应该正常。

其他回答

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

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

你有两种选择:

在project: build中添加类路径'com.google.gms:google-services:3.2.0'。gradle依赖性 而且 替换模块:build。Gradle依赖于编译实现 而且你不会收到任何警告信息。

在我的情况下,问题是谷歌服务gradle插件与以下一行在gradle文件:

应用插件:'com.google.gms.google-services'

删除这个就解决了这个问题

打开构建。Gradle文件位于这里:

这是编写依赖库的旧方法(对于gradle版本2及以下):

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile files('libs/volley.jar')
    compile 'com.android.support:support-v4:21.+'
}

这是导入gradle版本3依赖项的新方法(正确的):

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    implementation files('libs/volley.jar')
    implementation 'com.android.support:support-v4:21.+'
}