Dan*_*iel 6 android react-native
我刚刚通过以下方式初始化了一个新的 React Native 项目:
react-native init AwesomeProject
我已经收到此错误:
BUILD FAILED in 3s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
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 3s
at checkExecSyncError (child_process.js:637:11)
at execFileSync (child_process.js:655:13)
at runOnAllDevices (/Users/danale/Projects/engageMobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (/Users/danale/Projects/engageMobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:169:41)
at then.result (/Users/danale/Projects/engageMobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:135:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
Run Code Online (Sandbox Code Playgroud)
到目前为止,它只是一个样板应用程序。我使用 zsh 而不是 bash 作为命令行界面。
我也在 flutter 中开发,但没有遇到这个问题,它可以顺利打开 Nexus 5X 模拟器。
可能是什么问题呢?
我尝试更改权限,但不是这样。
所以显然我ios比android自动react-native run-ios为您打开模拟器有更多的经验,react-native run-android但重要的是,类似的命令,不要做类似的事情,即打开模拟器。
一旦我在 Android Studio 中打开应用程序,然后转到AVD Manager,打开 Android Studio 的模拟器,然后运行react-native run-android,它就完美运行了。
| 归档时间: |
|
| 查看次数: |
36734 次 |
| 最近记录: |