我正在尝试使用react-native运行AVD,但是出现未知变量错误

时间:2020-07-16 02:04:01

标签: react-native android-studio avd

我试图在Android Studio中将通过react-native创建的代码作为AVD运行,但是出现关于变量JAVA_HOME的错误。我该怎么办?

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_131

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

1 个答案:

答案 0 :(得分:0)

有时我们需要手动设置JAVA_JDK的路径(环境)。从官方网站安装最新的JAVA JDK。并设置jre和bin文件夹的路径。在查看您的目录C:\Program Files\Java\jdk1.8.0_131后,我猜您在Windows上,所以我不确定如何为Windows设置环境变量,但是绝对可以从youtube获得帮助。