在我的项目构建中,我已经替换了每一个compile by implementation的出现。gradle,但是我仍然得到这个警告:
我试图在整个项目中寻找“compile”,但没有找到匹配。那么原因是什么呢?
在我的项目构建中,我已经替换了每一个compile by implementation的出现。gradle,但是我仍然得到这个警告:
我试图在整个项目中寻找“compile”,但没有找到匹配。那么原因是什么呢?
当前回答
在我的情况下,问题是谷歌服务gradle插件与以下一行在gradle文件:
应用插件:'com.google.gms.google-services'
删除这个就解决了这个问题
其他回答
在我的例子中,它是一个使用compile来实现传递依赖的旧依赖:com.jakewharton.hugo
将它从我的gradle中删除后,它编译了。
https://issuetracker.google.com/issues/72479188表示插件有时会引入“编译”依赖项,这就是触发警告的原因。可能只是最简单的星号问题,并等待,直到他们修复它,指出哪些插件导致的问题。
回复谷歌:https://issuetracker.google.com/issues/74048134
会有一些依赖仍然使用编译,仔细检查你的应用程序依赖和传递依赖。
我在没有使用com.google.gms:google-services的情况下遇到了这个问题。 解决这类问题的方案如下:
检查构建。所有项目和模块的Gradle文件。或者只是全局搜索关键字“编译”,以找到引起此警告的原因。 如果上述方法无法解决此警告,则使用CLI命令, ./gradlew assembleDebug -d > gradle.log 打印详细的调试信息到一个名为gradle.log的文件或其他文件中,因为信息太多了。然后搜索“WARNING”在gradle.log中找到警告的位置,通常你可以找到哪个依赖或插件导致了警告。
回到你的位置。在项目级别的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
}