android - 添加 Material 设计支持后 list 合并失败并出现多个错误

标签 android manifest

我的应用程序之前运行良好,但最近在 android pie 更新后,我将 targetSDKVersion 更改为 28 并添加了 Material 设计支持,但出现此错误。

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:7:5-53:19 to override.

我已经更新了所有库并尝试了它给我的所有建议,但我仍然无法弄清楚该程序。以下是我添加的依赖项。

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:mediarouter-v7:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation group: 'com.android.support', name: 'customtabs', version: '28.0.0'
}

最佳答案

它说你的 support 依赖与 androidx.core 依赖有冲突

android studio 不能同时使用android x 依赖和之前的support 依赖。你应该只使用其中之一。

使用这些依赖项

implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'

使用此链接重构您的依赖项 https://developer.android.com/topic/libraries/support-library/refactor

关于android - 添加 Material 设计支持后 list 合并失败并出现多个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52566815/

相关文章:

java - 如何在 Android 库中打开一个类?

android - 在 onActivityResult 中检测电子邮件是否已发送

android - 使用 Gradle 的 Worker API 减少 gradle build 任务中的构建时间

android webview 不缓存整个 cache.manifest 文件

ClickOnce 通过编程更新但不是框架更新因无效 list 错误而失败

android - 未连接到 Android 上的网页

Android list 错误

Android ActionBarSherlock 在 Honeycomb/Galaxy Tab 上出错

java - Intent 抽屉导航 fragment

android - 阻止应用程序在安卓平板电脑上运行