React Native 运行没有错误无法在设备上启动?
React Native Runs Without Errors Doesn't Start on Device?
运行 通过 Mac OSX 上的 this 教程,我安装了 android studio 并构建了一个 Nexus 5 模拟器(API 27, Android 8.1.0)。当 运行ning react-native run-android
命令时,如果模拟器 运行ning 通过 android studio,则没有错误,但应用程序不会 运行ning on模拟器。
(请注意,上周我在修理分配给我的笔记本电脑时,在借用工作计算机上使用了这个,同样 OS,都是 macbook pro 15;该应用程序将在模拟器上自动启动)
如果我 运行 没有打开模拟器的命令,我得到这个输出:
JS server not recognized, continuing with build...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 1s
27 actionable tasks: 1 executed, 26 up-to-date
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
如果我 运行 打开模拟器的命令,我得到这个输出:
JS server not recognized, continuing with build...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_5X_API_27(AVD) - 8.1.0' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 2s
27 actionable tasks: 1 executed, 26 up-to-date
/bin/sh: adb: command not found
Starting the app (adb shell am start -n com.reactcalculator/com.reactcalculator.MainActivity...
模拟器永远不会改变。
解决方案
应用在设备上;它只是没有立即开始。我能够通过彻底检查应用程序列表找到它。貌似在某些环境下(比如我上面描述的借用者),app是自己启动的,而在其他环境下,需要手动启动。
应用程序存在,只是没有自动启动。
应用在设备上;它只是没有立即开始。我能够通过彻底检查应用程序列表找到它。貌似在某些环境下(比如我上面说的借用者),app是自己启动的,而在其他环境下,需要手动启动。
运行 通过 Mac OSX 上的 this 教程,我安装了 android studio 并构建了一个 Nexus 5 模拟器(API 27, Android 8.1.0)。当 运行ning react-native run-android
命令时,如果模拟器 运行ning 通过 android studio,则没有错误,但应用程序不会 运行ning on模拟器。
(请注意,上周我在修理分配给我的笔记本电脑时,在借用工作计算机上使用了这个,同样 OS,都是 macbook pro 15;该应用程序将在模拟器上自动启动)
如果我 运行 没有打开模拟器的命令,我得到这个输出:
JS server not recognized, continuing with build...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 1s
27 actionable tasks: 1 executed, 26 up-to-date
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
如果我 运行 打开模拟器的命令,我得到这个输出:
JS server not recognized, continuing with build...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_5X_API_27(AVD) - 8.1.0' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 2s
27 actionable tasks: 1 executed, 26 up-to-date
/bin/sh: adb: command not found
Starting the app (adb shell am start -n com.reactcalculator/com.reactcalculator.MainActivity...
模拟器永远不会改变。
解决方案
应用在设备上;它只是没有立即开始。我能够通过彻底检查应用程序列表找到它。貌似在某些环境下(比如我上面描述的借用者),app是自己启动的,而在其他环境下,需要手动启动。
应用程序存在,只是没有自动启动。
应用在设备上;它只是没有立即开始。我能够通过彻底检查应用程序列表找到它。貌似在某些环境下(比如我上面说的借用者),app是自己启动的,而在其他环境下,需要手动启动。