appComponentFactory 的清单合并失败 [英] Manifest Merger fails for appComponentFactory

查看:31
本文介绍了appComponentFactory 的清单合并失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Google 所谓的 Material Design 2.0 需要您添加

Using Google's so called Material Design 2.0 requires you to add

implementation 'com.google.android.material:material:1.0.0-rc01'

在应用程序 Gradle 中也包括

in the app Gradle which also includes

implementation 'com.android.support:appcompat-v7:28.0.0-rc02'    

显示冲突

日志内容如下

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-rc02] AndroidManifest.xml:22:18-91   

is also present at [androidx.core:core:1.0.0-rc01] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).     Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.

即使在将其添加到 Manifest 之后,它也会显示清单合并因多个错误而失败

Even after adding that to the Manifest it shows Manifest Merger failed with multiple error

推荐答案

这个错误现在很常见:

当我们收到此类错误时:当库更新并提供 AndroidX 的使用时,但我们使用的是旧的.

When we get this types of error: When library is updated and providing use of AndroidX but we are using old one.

您可以按照以下步骤解决此问题:

You can follow the steps to solve this:

  • 将您的项目迁移到 AndroidX:

使用 Android Studio 3.2 及更高版本,您可以快速迁移通过选择 Refactor > Migrate to 使用 AndroidX 的现有项目菜单栏中的 AndroidX.

With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.

注意:要迁移不使用任何第三方的现有项目具有需要转换的依赖项的库,您可以设置android.useAndroidX 标记为 trueandroid.enableJetifier 标记.

Note: To migrate an existing project that does not use any third-party libraries with dependencies that need converting, you can set the android.useAndroidX flag to true and the android.enableJetifier flag to false.

此步骤将自动执行所有答案都要求手动执行的所有操作

  • 您可以在此处查看AndroidX概述.
  • 有关迁移
  • 的更多详细信息
  • You can check Overview of AndroidX here.
  • More details for migration

即使您遇到任何其他错误,例如运行时构建失败,那么:

Even If you get any other error like run-time build failed, then:

  • 使缓存无效并重新启动

  • 清理你的项目

希望对大家有所帮助.谢谢.

Hope it will helps to all. Thank you.

这篇关于appComponentFactory 的清单合并失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆