我正在尝试使用以下命令运行一个本机应用程序
npx react-native run-android --variant=stagingDebug --appId com.ursafe_staging
但是得到错误的环境路径错误
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_202\bin
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.
Error: Command failed: gradlew.bat app:installStagingDebug -PreactNativeDevServerPort=8081
下面是我的环境路径
还有这张
运行命令时仍会收到错误信息。
发布于 2022-08-30 17:25:45
JAVA_HOME
不应该指向bin
目录。它应该指向JDK安装路径。
应该是:C:\Program Files\Java\jdk1.8.0_202
,如果您已经拥有了%JAVA_HOME%\bin
,也不需要JRE,请参阅https://www.baeldung.com/java-home-on-windows-7-8-10-mac-os-x-linux
https://stackoverflow.com/questions/73546332
复制相似问题