【问题标题】:Error running run-android on react native在 react native 上运行 run-android 时出错
【发布时间】:2019-08-27 17:34:44
【问题描述】:

我正在尝试运行 react native 一个在 android 上传递给我的项目并给出错误

已经尝试将 gradle.properties 文件更改为使用 AndroidX 但只给出另一个错误,已经尝试将清单文件更改为错误犯规但也不起作用

错误图片:
https://i.imgur.com/CUNHb7N.png


> Task :app:processDebugManifest FAILED
/home/leleuvilela/Workspace/waproject-base-app/android/app/src/main/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

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


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.CoreComponentFactopport-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.CoreCompo
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml

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

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

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

BUILD FAILED in 5s
132 actionable tasks: 122 executed, 10 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 app:installDebug. Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

【问题讨论】:

    标签: android reactjs react-native manifest


    【解决方案1】:

    您只需在{your app path}\android\gradle.properties 文件的末尾添加这两行。

    android.enableJetifier=true
    android.useAndroidX=true
    

    【讨论】:

      猜你喜欢
      • 2018-05-20
      • 2021-09-13
      • 1970-01-01
      • 1970-01-01
      • 2020-12-29
      • 2019-06-10
      相关资源
      最近更新 更多