【问题标题】:variant.getAssemble() is obsolete and has been replaced with variant.getAssembleProvider()variant.getAssemble() 已过时并已替换为 variant.getAssembleProvider()
【发布时间】:2019-09-10 09:13:55
【问题描述】:

我没有从我的项目中调用 variant.getAssemble(),但仍然显示这些消息。当我尝试运行该项目时,我收到此错误“Manifest Merger failed with multiple errors in Android Studio "

'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.

Gradle.build 文件在这里,我这里没有使用 variant.getAssemble()。如果系统正在调用它,那么我在哪里可以找到它来解决问题。我有多个模块。

apply plugin: 'com.android.application'

apply plugin: 'com.google.firebase.firebase-crash'

dependencies {

implementation project(':A')
implementation project(':B')
implementation project(':C')
implementation project(':D')
//implementation project(':E')
implementation project(':F')
implementation project(':G')

implementation "com.android.support:appcompat-v7:$project.supportVersion"
implementation "com.android.support:support-v4:$project.supportVersion"
implementation "com.android.support:cardview-v7:$project.supportVersion"
implementation "com.android.support:recyclerview-v7:$project.supportVersion"
implementation "com.android.support:design:$project.supportVersion"
implementation "com.android.support:support-v13:$project.supportVersion"
implementation "com.android.support:support-vector-drawable:$project.supportVersion"

implementation "com.google.firebase:firebase-core:$project.firebaseCore"
implementation "com.google.firebase:firebase-ads:$project.firebaseAds"
implementation "com.google.firebase:firebase-auth:$project.firebaseAuth"
implementation "com.google.firebase:firebase-messaging:$project.firebaseMessaging"
implementation "com.google.firebase:firebase-crash:$project.firebaseCrash"

implementation "com.google.code.gson:gson:$project.gsonVersion"
implementation "com.google.guava:guava:$project.guavaVersion"
implementation "org.jsoup:jsoup:$project.jsoupVersion"
implementation "ch.acra:acra:$project.acraVersion"
implementation "com.mcxiaoke.volley:library:$project.volleyVersion"
// optional

debugImplementation "com.squareup.leakcanary:leakcanary-android:$project.leackcanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$project.leackcanaryVersion"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$project.leackcanaryVersion"
implementation 'com.android.support:multidex:1.0.3'
implementation "com.squareup.retrofit2:retrofit:$project.RetrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$project.RetrofitGsonVersion"
}

android {

defaultConfig {
    applicationId "com.XXX.XXXX"
    multiDexEnabled = true
    vectorDrawables.useSupportLibrary = true
}

android.applicationVariants.all { variant ->
    variant.outputs.all { output ->
        def relativeRootDir = output.packageApplication.outputDirectory.toPath().relativize(rootDir.toPath()).toFile()
        output.outputFileName = new File( "$relativeRootDir" + File.separator+"libs", project.name+"-"+project.versionName+".apk")
    }
}
}

apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 不,谢谢您的回复
  • 当我隐藏这一行“应用插件:'com.google.firebase.firebase-crash'”时收到此错误“警告:API 'variantOutput.getPackageApplication()' 已过时并已替换为'variant.getPackageApplicationProvider()'。它将在 2019 年底被删除。”如果我不隐藏这一行,我会收到此错误“警告:API 'variant.getAssemble()' 已过时,已被 'variant.getAssembleProvider()' 取代。它将在 2019 年底被删除。”如果我运行该项目,我会发现此错误“清单合并失败并出现多个错误,请参阅日志”。请帮我解决这个问题

标签: android android-gradle-plugin


【解决方案1】:

您可以放心地忽略它。一些像 Fabric 这样的插件会导致这些警告,因为它的开发人员必须适应新的 Android Studio/Gradle 版本。只需确保使用最新版本的依赖项即可。

【讨论】:

  • 没有添加类似库的面料,所有版本都是最新的
  • apply plugin: 'com.google.firebase.firebase-crash' 可能这个是罪魁祸首,你可以尝试评论一下。但是您的崩溃分析将不起作用,因此只需忽略警告即可。您的应用仍然可以正常运行。
  • 现在我收到此错误消息:“API 'variantOutput.getPackageApplication()' 已过时并已替换为 'variant.getPackageApplicationProvider()'。”
  • apply plugin: 'com.google.gms.google-services' 好吧,只有这个会导致这种情况,但是如果没有它,您的构建可能会崩溃
  • 检查 AndroidManifest.xml 中的错误是什么。打开 AndroidManifest.xml 文件并选择文件窗口下方的“Merged Manifests”选项卡。
猜你喜欢
  • 2019-09-28
  • 2019-06-09
  • 2019-02-23
  • 2019-05-23
  • 1970-01-01
  • 2019-12-11
  • 1970-01-01
  • 2019-06-16
  • 2019-06-09
相关资源
最近更新 更多