我在我的项目中遇到非常烦人的警告:WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.It will be removed at the end of 2019.For more information, see https://d.android.com/r/tools/task-configuration-avoidance.REASON: It is currently called from the following trace:...WARNING: Debugging obsolete API calls can take time during configuration. It's recommended to not keep it on at all times.Affected Modules: app由于此警告明年将成为错误,因此我想一劳永逸地修复它。我已经更新了 gradle 插件、google play 服务插件和所有依赖项,但问题仍然存在。这是项目级build.gradle文件:buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.4.1' classpath 'com.google.gms:google-services:4.3.0' }}allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } }}task clean(type: Delete) { delete rootProject.buildDir}这是模块应用程序build.gradle文件:apply plugin: 'com.android.application'android { compileSdkVersion 28 buildToolsVersion "28.0.3" defaultConfig { applicationId "com.foo.bar" minSdkVersion 16 targetSdkVersion 28 versionCode 9 versionName "1.08" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } lintOptions { checkReleaseBuilds false //If you want to continue even if errors found use following line abortOnError false }}dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) ...}apply plugin: 'com.google.gms.google-services'如您所见,我没有getMergeResources()直接使用,因此它必须是依赖项之一。我已经一个一个地注释掉依赖项,最后得到一个空的依赖项列表。但是,仍然发出警告。然后我发现注释掉apply plugin: 'com.google.gms.google-services'可以解决问题。但我使用最新的谷歌服务插件,如果没有它,我显然无法使用任何与 firebase 相关的东西。我怎样才能解决这个问题?我不喜欢降级 gradle 插件,因为它只是一个临时修复。
3 回答
慕的地10843
TA贡献1785条经验 获得超8个赞
两个版本的Google Services Gradle Plugin ( 4.3.0& 4.3.1) 导致此问题,将版本升级到4.3.2似乎可以解决问题;
在您的项目级build.gradle文件中,在 下buildscript -> dependencies,检查您是否有此行
classpath 'com.google.gms:google-services:4.3.x'
如果是这样,将其更改为
classpath 'com.google.gms:google-services:4.3.3'
编辑:点击此处查看最新版本。(4.3.3) 在编辑时。
哈士奇WWW
TA贡献1799条经验 获得超6个赞
桃花长相依
TA贡献1860条经验 获得超8个赞
请更改项目级别 Gradle 中的类路径依赖项:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}我正在使用它。它工作正常。这是一个稳定的版本。希望这个问题会在这个依赖的未来版本中得到解决。
添加回答
举报
0/150
提交
取消
