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

查看:1038
本文介绍了清单合并对于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.

即使将其添加到清单中,它也会显示 清单合并失败,并出现多个错误

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标志设置为 true android.enableJetifier标志 变为 false .

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:

  • 使缓存无效并重新启动

OR

  • 清理您的项目

希望对所有人有帮助. 谢谢.

Hope it will helps to all. Thank you.

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

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