首页 > 解决方案 > 最新的 React 本机项目未在 android 中构建

问题描述

react-native 版本“0.60.3”对我不起作用。但是旧版本(例如:0.57.8)可以工作。我怎样才能让它工作?

D:\Apps\test>react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using
 "--no-jetifier" flag.
Jetifier found 856 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
> Task :app:mergeDebugResources FAILED
10 actionable tasks: 3 executed, 7 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> 8 exceptions were raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #0: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #2: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #1: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #3: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #4: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #5: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #6: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1
-5326820-windows Daemon #7: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it
does.


* 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

BUILD FAILED in 7s

error Failed to install the app. Make sure you have the Android development envi
ronment set up: https://facebook.github.io/react-native/docs/getting-started.htm
l#android-development-environment. Run CLI with --verbose flag for more details.

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8
081

FAILURE: Build failed with an exception.

标签: androidreact-nativereact-native-android

解决方案


同样的情况发生在我身上。但如果你正在使用..

react-native run-android --no-jetifier.

代替react-native run-android它将正常工作


推荐阅读