给出错误:
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).
等级依赖
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 ticket帮助我解决了这个问题,这似乎是一个androidx和react-native问题。获得了gms和firebase版本here
答案 0 :(得分:1)
您需要从andorid.support和android.arch依赖项迁移到AndroidX。错误消息提示您的项目存在冲突,可能是由于对本机依赖状态做出了反应
TL; DR
摆脱所有andorid.support
和android.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'
并对所有支持依赖项进行类似操作
答案 1 :(得分:1)
我通过在android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
android.enableJetifier=true
android.useAndroidX=true
将这些标志放入您的 gradle.properties
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
等级中的更改:
payment gateway