android - 如何修复 React Native 中任务 ':app:processDebugManifest' 的执行失败?

标签 android android-studio react-native gradle android-manifest

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

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-reanimated 以使 react-navigation-drawer 工作时遇到了这个问题。

修复是:

  1. 添加到 android/gradle.properties:
android.enableJetifier=true
android.useAndroidX=true
  1. yarn 添加喷射器

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

  3. 运行: yarn jetify

  4. react-native run-android

我的 RN 版本 0.59.8

关于android - 如何修复 React Native 中任务 ':app:processDebugManifest' 的执行失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56644149/

相关文章:

android - 在 Android 状态栏中放置一个图标

android - 无法构建 Android APK - 任务 ':app:mergeDebugResources' 执行失败

react-native - 从功能组件 React Native 调用功能

css - 如何将 View 放在标题顶部,其中一部分位于标题后面的边界之外?

javascript - React Native Flex 单独对齐组件

android - Android Studio 未找到 TestCase 类

java - 适用于 Android 的 Google 跟踪代码管理器 NullPointerException

android-studio - Android Studio 未在 Windows 10 中启动 : Internal error. 请报告 https ://code. google.com/p/android/issues

android - 如何使用 map View 获取谷歌地图上的当前位置

java - 为什么Android studio上找不到小程序?