android - appComponentFactory 的 list 合并失败

标签 android android-studio manifest

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

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

在应用程序 Gradle 中,其中还包括

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.

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

最佳答案

这个错误现在很常见:

当我们收到此类错误时:当库更新并提供 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.

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概述here .
  • 更多详细信息migration

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

  • 使缓存无效并重新启动

或者

  • 清理您的项目

希望对大家有帮助。 谢谢。

关于android - appComponentFactory 的 list 合并失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59433643/

相关文章:

java - 复制 BuildConfig 在 Android Studio 中集成 Unity Ads

google-chrome-extension - 如何将 "legacy packaged app"更改为 "extension"?

java - 无法在 Windows 上运行我的 jar 文件

android - BottomNavigationView 正在隐藏我的 WebView

android - Observable 在 Kotlin 中列出

Android Studio 在 xml 文件中显示一些困惑

android - 如何在Android Studio 1.3中配置NDK项目

android - 将设置 <supports-screens android :smallScreens ="false"> hide the App in the Android Market for such devices?

java - 错误 : incompatible types: NewSubscription cannot be converted to Context

Android 检查目标 sdk 22 或更低版本中的相机权限