繁体   English   中英

如何修复 React Native 中任务“:app:processDebugManifest”的执行失败?

[英]How to fix Execution failed for task ':app:processDebugManifest' in React Native?

我在运行项目时发现一个错误,我尝试寻找很多示例但都失败了,这是错误的详细信息:

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.

请任何人帮助我解决这个问题。

谢谢

将“react-native-device-info”升级到版本 2.1.2 为我修复了错误。 http://github.com/facebook/react-native/issues/25294#issuecomment-503024749

所以我在安装react-native-reanimated时遇到了这个问题,以使react-navigation-drawer工作。

修复是:

  1. 添加到 android/gradle.properties:
android.enableJetifier=true
android.useAndroidX=true
  1. yarn add jetifier

  2. 在android目录中运行: ./gradlew clean

  3. 运行: yarn jetify

  4. react-native run-android

我的 RN 版本 0.59.8

2天后终于找到了解决方案,并在android/build.gradle下面添加了两行

googlePlayServicesVersion = "16.+"

firebaseVersion = "17.3.4"

我有更多依赖于 gcm 的库(除了 deviceinfo)所以我用它来解决这个问题: https : //stackoverflow.com/a/56648987/8306924

您只需要编辑“gradle.properties”并添加:

android.useAndroidX=true
android.enableJetifier=true

所以你解决了google和第三方依赖之间的依赖冲突。

我有同样的问题,并在 android > build.gradle 上更改了 gradle 的版本并解决了我的问题

classpath("com.android.tools.build:gradle:4.2.2")

classpath("com.android.tools.build:gradle:7.1.1")

清理 gradle 并再次构建

在 android 目录命令提示符下:

#gradlew clean
#gradlew build

我将 java 版本从17降级到15并且它有效

更新到 Java 版本 16 可能会导致此问题。 请降级 Java 到版本 <= 15。这帮助我解决了这个错误。

第一个 React Native App:任务 :app:processDebugMainManifest FAILED

JDK 16、17及以上版本的React Native Android项目中task:app:processDebugMainManifest' Execution failed的解决方法是在你的项目的./android/gradle.properties文件中添加以下行:

org.gradle.jvmargs=--add-opens java.base/java.io=ALL-UNNAMED

暂无
暂无

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

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