简体   繁体   English

构建失败,发生异常反应本机

[英]Build failed with an exception react native

while running react-native run-android I am getting below exception... It was running fine and I made a git pull and did npm ci and after that, it is coming. 在运行react-native run-android时,我遇到了异常...运行得很好,我进行了git pull并执行了npm ci,此后它就来了。 There are no changes in the new pull also. 新的拉动也没有变化。 In fact for after doing git colon that is also the same issue. 实际上,对于执行git冒号之后的问题也同样如此。 And it's running well in MAC. 而且它在MAC中运行良好。 Please help I am stuck. 请帮助我被卡住。

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:13:5-33:19 to override.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5s
128 actionable tasks: 3 executed, 125 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

Thanks 谢谢

I solved this 我解决了这个

npm uninstall react-native-device-info

and then 接着

npm install --save react-native-device-info

latest version should be 2.1.2 最新版本应为2.1.2

Add this to your app/build.gradle dependencies: 将此添加到您的app / build.gradle依赖项中:

configurations.all {
        resolutionStrategy {
            force 'com.google.android.gms:play-services-gcm:16.1.0'
            force 'com.google.android.gms:play-services-base:16.1.0'
            force 'com.google.firebase:firebase-core:16.0.9'
            force 'com.google.firebase:firebase-messaging:18.0.0'
    }
}

This basically forces your third party libraries(like deviceinfo) that depend on gcm, to use the 16.1.0 version. 这基本上迫使依赖gcm的第三方库(例如deviceinfo)使用16.1.0版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM