React Native错误:“无法从'9.0.1'确定Java版本。” [英] React Native error: "Could not determine java version from '9.0.1'."
问题描述
我在MacOS上工作,刚开始使用 react-native
。
第一步要开始运行: react-native run-android
或 react-native run-ios
。但是我收到了这个错误:
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $扫描文件夹以查找/ Users中的符号链接/ ric / myprojs / albums / node_modules(6ms)
启动JS服务器...
在设备上构建并安装应用程序(cd android&&& ./gradlew installDebug)...
FAILURE:构建失败,出现异常。
*出错:
无法从'9.0.1'确定java版本。
*尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。
无法在设备上安装应用程序,请阅读上面的错误以了解详细信息。
确保您有一个Android模拟器正在运行或连接了一个设备,并且有
设置您的Android开发环境:
https://facebook.github.io/react-native/docs/android -setup.html
当我运行 java时,版本
:
$ java --version
java 9.0.1
Java™SE运行时环境(build 9.0.1 + 11)
Java HotSpot™64位服务器虚拟机(build 9.0.1 + 11,mixed mode)
mbp:albums ric $ java --version
Java 9.0.1
Java™SE运行时环境(build 9.0.1 + 11)
Java HotSpot™64位服务器虚拟机(build 9.0.1+ 11,混合模式)
EDITED :
这就是当我运行 javac --version
:
$ b $
$ javac - -version
javac 9.0.1
有关如何解决这个问题的想法?
在文件中,
P ROJECT_PATH / android / gradle / wrapper / gradle-wrapper.properties
更新您的distributionUrl至以下内容:
distributionUrl = https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
I'm working on MacOS and just starting with react-native
.
One of the first steps to get started is to run: react-native run-android
or react-native run-ios
. But I'm getting this error:
$ react-native run-android
Scanning folders for symlinks in /Users/ric/myprojs/albums/node_modules (6ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '9.0.1'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
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
This is what I get when I run java --version
:
$ java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
mbp:albums ric$ java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
EDITED:
This is what I get when I run javac --version
:
$ javac --version
javac 9.0.1
Any idea on how to fix this?
In file,
PROJECT_PATH/android/gradle/wrapper/gradle-wrapper.properties
Update your distributionUrl to the following
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
这篇关于React Native错误:“无法从'9.0.1'确定Java版本。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!