Android 生成失败,出现异常

Android 生成失败,出现异常,android,react-native,Android,React Native,在运行react native run android时,我遇到以下异常。。。 它运行得很好,我做了一个git pull,做了npmci,之后,它就来了。新拉力也没有变化。事实上,在做了git之后,冒号也是同样的问题。 而且它在MAC中运行良好。 请帮帮我,我卡住了 失败:生成失败,出现异常 * What went wrong: Execution failed for task ':app:processDebugManifest'. > Manifest merger failed :

在运行react native run android时,我遇到以下异常。。。 它运行得很好,我做了一个
git pull
,做了npmci,之后,它就来了。新拉力也没有变化。事实上,在做了git之后,冒号也是同样的问题。 而且它在MAC中运行良好。 请帮帮我,我卡住了

失败:生成失败,出现异常

* 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.
*出了什么问题:
任务“:app:processDebugManifest”的执行失败。
>清单合并失败:属性application@appComponentFactory值=(android.support.v4.app.CoreComponentFactory)来自[com.android.support:support compat:28.0.0]AndroidManifest.xml:22:18-91
在[androidx.core:core:1.0.0]AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory)中也存在。
建议:在AndroidManifest.xml:13:5-33:19处的元素中添加“tools:replace=“android:appComponentFactory””以覆盖。
*尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的洞察力。
*得到更多的帮助https://help.gradle.org
此版本中使用了不推荐的Gradle功能,使其与Gradle 5.0不兼容。
使用“--warning mode all”显示单个弃用警告。
看见https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
构建在5s内失败
128项可执行任务:3项已执行,125项最新
错误:无法在设备上安装应用程序,请阅读上面的错误以了解详细信息。
确保您有一个运行的Android模拟器或连接的设备,并且
设置您的Android开发环境:
https://facebook.github.io/react-native/docs/getting-started.html
错误命令失败:gradlew.bat应用程序:installDebug。有关详细信息,请使用--verbose标志运行CLI。

谢谢

将此添加到您的应用程序/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'
    }
}
这基本上迫使依赖gcm的第三方库(如deviceinfo)使用16.1.0版本。

我解决了这个问题

npm uninstall react-native-device-info
然后

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

最新版本应该是2.1.2

谢谢你,伙计,它暂时解决了这个问题。但最终的解决方案是切换到RN 0.60+和androidX:我不使用这些dependencies@AbhigyanGaurav我也没有用过两个,但它是为我设计的,尝试一次@Żabojad是的,这是一个临时修复-强制使用库版本无论如何都不理想。@AnshuKumar是的,如果设备信息是您使用的唯一一个依赖于gcm的库,那么它可以工作,但是就像我们的例子一样,我们有多个库具有这种依赖性(与deviceinfo不同,所有人都没有更新自己的库以符合gcm的新版本),因此我们暂时回滚了gcm版本本身。