【发布时间】:2020-04-27 15:58:50
【问题描述】:
您好,我是 react native 的新手,我已经按照文档安装了所有需要的工具来使用 android studio 运行 react-native。
这是我的 sdk 平台设置
我可以手动启动虚拟设备,它会显示并正常工作,
但是当我运行react-native run-android 时,我收到以下错误
PS C:\custom-xammp\htdocs\shoppingList> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 963 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
'adb' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
at makeError (C:\custom-xammp\htdocs\shoppingList\node_modules\execa\index.js:174:9)
at Promise.all.then.arr (C:\custom-xammp\htdocs\shoppingList\node_modules\execa\index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)
PS C:\custom-xammp\htdocs\shoppingList>
我需要做什么来解决这个问题?
【问题讨论】:
标签: android react-native android-studio