React Native requires version 8 of the Java SE Development Kit (JDK). You may download and install OpenJDK from AdoptOpenJDK or your system packager. You may also Download and install Oracle JDK 8 if desired.
我记得尝试安装 JDK 的最后一个命令是
sudo pacman -S jdk8-openjdk
当我运行时
npx react-native run-android
在项目目录上,我收到此错误:
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/jdk1.8.0
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
我使用的是 Manjaro Linux。
最佳答案
我也有同样的问题。如果您在 android studio 中打开 android 项目,则在那里构建它。然后返回终端并运行 npx react-native start
它可以工作
但是,我仍然遇到同样的问题,试图让 npx react-native run-android
正常工作。
关于java - 在 Manjaro Linux 上为 React Native 运行 JDK 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59979132/