首页 > 解决方案 > 如何删除清单合并错误

问题描述

我在没有使用 androidx 的项目中添加了 MaterialAlertDialog。这会在下一次构建期间导致错误。所以我从应用程序级别的构建 gradle 中删除了“实现”语句。但是当我尝试构建我的项目时,我仍然有明显的合并错误。

这是我在构建时遇到的错误

清单合并失败:来自 [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 的属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) 也存在于[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory)。建议:将 'tools:replace="android:appComponentFactory"' 添加到 AndroidManifest.xml:19:5-152:19 的元素以覆盖。

到目前为止,我已经尝试了以下解决方案,关闭并重新加载我的项目。清理并重建 .delete 项目中的 .gradle 和 .idea 文件夹,然后重新构建

这些是我项目中的依赖项

    dependencies 
    {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
            })
        implementation "com.android.support:appcompat-v7:${android_support_version}"
        implementation "com.android.support:design:${android_support_version}"
        implementation 'com.github.lzyzsd:circleprogress:1.1.0@aar'
        implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1@aar'
        implementation 'commons-net:commons-net:3.3'
        implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
            transitive = true
        }

        implementation "de.hdodenhof:circleimageview:${circle_imageview}"
        implementation "com.github.bumptech.glide:glide:${glide_version}"
        implementation "com.android.support:recyclerview-v7:${android_support_version}"
        implementation "com.android.support:cardview-v7:${android_support_version}"
        implementation "com.squareup.retrofit2:retrofit:${retrofit_service_version}"
        implementation "com.squareup.retrofit2:converter-gson:${retrofit_gson_convertor}"
        implementation "com.clough.android.androiddbviewer:androiddbviewer:${dbviewer_version}"
        implementation "com.android.support:multidex:${multidex_version}"
        implementation "com.github.crosswall:Android-Coverflow:${viewPager_version}"
        implementation "com.squareup.okhttp3:logging-interceptor:3.4.0"
        implementation project(':sdkui')
        implementation 'com.github.ronaldsmartin:Material-ViewPagerIndicator:1.0.4'
        implementation 'com.google.android.gms:play-services-base:16.0.1'
        implementation 'com.google.android.gms:play-services-identity:16.0.0'
        implementation 'com.google.android.gms:play-services-auth:16.0.1'
        implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'
        implementation 'com.google.firebase:firebase-config:16.1.0'
        implementation 'com.google.firebase:firebase-core:16.0.4'
        implementation 'com.google.firebase:firebase-messaging:20.0.0'
    }
    apply plugin: 'com.google.gms.google-services'

标签: androidandroid-manifestandroidx

解决方案


我回答这个只是为了指定解决我的问题所采取的步骤。

  1. 我删除了 MaterialDesign 的 gradle 依赖项。
  2. 通过执行 File-> Invalidate Cache & restart 解决了现金问题

由于 Firebase 在重新启动之前已更改为 20 版,因此问题仍然存在。

将 Firebase 版本降低到 17.3.4,这解决了所有问题。


推荐阅读