首页 > 解决方案 > 清单合并失败 android.support.v4.app.CoreComponentFactory

问题描述

给出的错误:

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).

Gradle 依赖项

dependencies {
implementation project(':react-native-image-resizer')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-device-info')
implementation project(':react-native-camera')
implementation project(':react-native-agora')
implementation fileTree(dir: "libs", include: ["*.jar"])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

implementation "com.facebook.react:react-native:+"  // From node_modules
implementation 'com.getkeepsafe.relinker:relinker:1.3.0'
implementation 'com.android.volley:volley:1.1.0'
implementation files('src/main/jniLibs/HCNetSDK.jar')
implementation files('src/main/jniLibs/PlayerSDK.jar')
implementation 'com.ncorti:slidetoact:0.5.1'
implementation 'com.squareup.picasso:picasso:2.71828'

implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.pusher:push-notifications-android:1.0.2'
}

编辑:这张GitHub 票帮助我解决了它,似乎是一个 androidx 和 react-native 问题。在这里获得 gms 和 firebase 版本

标签: androidreact-nativegradleandroid-manifest

解决方案


您需要从 andorid.support 和 android.arch 依赖项迁移到 AndroidX。您的项目有冲突,因为错误消息可能是因为反应原生依赖,

这个链接应该有帮助

也看看这里

TL;DR 摆脱所有依赖项andorid.supportandroid.arch改用 androidX

例如改变

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

进入

implementation 'androidx.constraintlayout:constraintlayout:1.1.2',

第二个示例更改

implementation 'com.android.support:animated-vector-drawable:28.0.0'

进入

implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'

并对所有支持依赖项执行类似操作


推荐阅读