小编典典

React Native无法运行stacktrace

java

我正在尝试建立一个测试项目并在Mac(osx 10.12)上与React Native一起运行。如果我运行:

react-native run-android --stacktrace

我收到以下错误:

error: unknown option '--stacktrace'

我已经安装了:

  • Node watcher
  • flow
  • Java JDK
  • Android SDK
  • React to nativeCLI
  • Genymotion

当我运行命令时,模拟器正在运行。

谁能告诉我为什么会这样吗?提前谢谢了。

编辑 运行后,gradlew installDebug --stacktrace我得到以下响应:

07:20:21 V/ddms: execute: running am get-config
07:20:21 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
07:20:21 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel_2_API_28(AVD) - 9' for app:debug
07:20:21 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'
07:20:21 D/Device: Uploading file onto device 'emulator-5554'
07:20:21 D/ddms: Reading file permision of /Users/kristian/Documents/Work/Roche/roche-mobile-app/android/app/build/outputs/apk/debug/app-debug.apk as: rw-r--r--
07:20:21 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
07:20:21 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
07:20:21 V/ddms: execute: returning
07:20:21 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
07:20:22 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
07:20:22 V/ddms: execute: returning
Installed on 1 device.

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

阅读 360

收藏
2020-12-03

共1个答案

小编典典

--stacktrace建议不是react-native run- android命令输出的,它来自它运行的命令之一。使用--stacktrace选项运行它的方法如下。进一步阅读以获取解释。

cd android && ./gradlew installDebug --stacktrace

react-native run-android``cd android && ./gradlew installDebug正如您在以下输出的以下行中看到的那样,它实际运行react-native run-android

Running /Users/upside/Library/Android/sdk/platform-tools/adb -s 0111474880b8a726 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug)...

因此,如果要使用该--stacktrace选项运行,则需要运行cd android && ./gradlew installDebug --stacktrace

解决问题后,应重新使用,react-native run-android因为脚本可能还会运行很多命令。

2020-12-03