运行项目时发现错误,我尝试查找许多示例,但全部失败,这是错误的详细信息:
D:\myApp\android\app\src\debug\AndroidManifest.xml:22:18-91 Error:
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 <application> element at AndroidManifest.xml:7:5-117 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
> Task :app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> 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 <application> element at AndroidManifest.xml:7:5-117 to override.
请任何人帮助我解决此问题。
谢谢
答案 0 :(得分:3)
将'react-native-device-info'升级到版本2.1.2,为我解决了该错误。 参见http://github.com/facebook/react-native/issues/25294#issuecomment-503024749
答案 1 :(得分:2)
我还有更多依赖gcm的库(deviceinfo除外),所以我用它来解决问题:https://stackoverflow.com/a/56648987/8306924
答案 2 :(得分:2)
两天后终于找到了解决方案,只是将以下两行添加到android / build.gradle
googlePlayServicesVersion =“ 16。+”
firebaseVersion =“ 17.3.4”
答案 3 :(得分:0)
您只需要编辑“ gradle.properties”并添加:
android.useAndroidX=true
android.enableJetifier=true
因此,您解决了Google与第三方依赖关系之间的依赖关系冲突。
答案 4 :(得分:0)
因此,在安装react-native-reanimated
以便使react-navigation-drawer
工作时,我遇到了这个问题。
解决方法是:
android.enableJetifier=true
android.useAndroidX=true
yarn add jetifier
在android目录中运行:
./gradlew clean
运行:
yarn jetify
react-native run-android
我的RN版本0.59.8