【问题标题】:React Native cannot run stacktraceReact Native 无法运行堆栈跟踪
【发布时间】:2016-10-13 13:19:30
【问题描述】:

我正在尝试在 Mac (osx 10.12) 上使用 React Native 启动并运行一个测试项目。如果我跑:

react-native run-android --stacktrace

我收到以下错误:

error: unknown option '--stacktrace'

我已经安装了:

  • 节点守望者
  • 流程
  • Java JDK
  • Android SDK
  • React Native CLI
  • 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

【问题讨论】:

    标签: java android macos react-native


    【解决方案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,因为该脚本可能还会运行更多命令。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-25
      • 2011-05-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多