我目前正在尝试运行本机应用程序,但在 Windows 10 中出现此错误。
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_251;
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://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
at checkExecSyncError (child_process.js:630:11)
at execFileSync (child_process.js:648:15)
at runOnAllDevices (C:\Users\User\Desktop\crate\crate\code\mobile\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\Users\User\Desktop\crate\crate\code\mobile\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:179:41)
at C:\Users\User\Desktop\crate\crate\code\mobile\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:133:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (C:\Users\User\Desktop\crate\crate\code\mobile\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:182:9)
我已经安装了 java 并且它的工作方式就像这张图片
另外,我在使用此代码之前运行模拟器,就像在这张图片中一样, 它也给了我这个错误,但模拟器工作。
Failed to open /qemu.conf, err: 2
在这种情况下我做了什么错误的举动?