最新的React本机项目未在android中构建

时间:2019-07-15 19:11:02

标签: android react-native react-native-android

本机版本“ 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.
  • 出了什么问题: 任务':app:mergeDebugResources'的执行失败。
      工人提出了8个例外:     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#0:守护程序启动失败     通常情况下不应发生这种情况,如果存在则请提出问题   做。     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#2:守护程序启动失败     通常情况下不应发生这种情况,如果存在则请提出问题   做。     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#1:守护程序启动失败     通常情况下不应发生这种情况,如果存在则请提出问题   做。     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#3:守护程序启动失败     通常情况下不应发生这种情况,如果存在则请提出问题   做。     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#4:守护程序启动失败     通常情况下不应发生这种情况,如果存在则请提出问题   做。     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#5:守护程序启动失败     通常情况下不应发生这种情况,如果存在则请提出问题   做。     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#6:守护程序启动失败     通常情况下不应发生这种情况,如果存在则请提出问题   做。     com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.1   -5326820-windows守护程序#7:守护程序启动失败

2 个答案:

答案 0 :(得分:0)

对我来说是一样的情况。但是,如果您使用的是..

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

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

答案 1 :(得分:0)

我刚从最新版本开始构建,没有收到任何错误,如下所示:

react-native init NewProject

npx react-native run-android

这没有启动我的Metro构建器,因此在另一个终端中-

react-native start

然后:

npx react-native run-android

环境:

节点:v10.2.1 NPM / NPX:v6.9.0 Mac OSx

Package.json

{
  "name": "testproj",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.8.6",
    "react-native": "0.60.3"
  },
  "devDependencies": {
    "@babel/core": "^7.5.0",
    "@babel/runtime": "^7.5.0",
    "@react-native-community/eslint-config": "^0.0.3",
    "babel-jest": "^24.1.0",
    "jest": "^24.1.0",
    "metro-react-native-babel-preset": "^0.54.1",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}