我一步一步地遵循官方的Getting Started.我从一个干净的linux安装开始,按照"使用本机代码构建项目"选项卡安装了所有需要的东西.我还阅读了故障排除部分.我已经用终端创建了这个项目.
这是我运行react-native run-android
时的错误:
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
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.
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
它找不到JAVA_HOME,因为最新版本的Android Studio不需要在系统中安装JAVA.而是使用内部JRE.
Duplicate disclaimer:我已经读了this question本了.这不是我想要的.我知道如何设置Java主页.我只想运行react项目,而不必安装单独的Java.
问题:
- 如何在Android Studio文件夹中找到内部Java,以便将Java_指向它的主页?
- 如果不可能,我可以用Android Studio打开并运行
android
文件夹中的项目吗?在修改父文件夹中的React JavaScript代码后,如何刷新此项目?