我在我的項目中遇到非常煩人的警告: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 插件,因為它只是一個臨時修復。
API“variant.getMergeResources()”已過時并已替換為
慕田峪9158850
2023-02-23 17:23:16