使用 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 theandroid.enableJetifier
flag to false.
此步骤将自动执行所有答案要求手动执行的所有操作
即使您收到任何其他错误(例如运行时构建失败),那么:
- 使缓存无效并重新启动
或者
- 清理您的项目
希望对大家有帮助。 谢谢。
关于android - appComponentFactory 的 list 合并失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59433643/