Tôi đang làm việc trên MacOS và chỉ bắt đầu với react-native
.Lỗi gốc phản ứng: "Không thể xác định phiên bản java từ '9.0.1'."
Một trong những bước đầu tiên để bắt đầu là chạy: react-native run-android
hoặc react-native run-ios
. Nhưng tôi nhận được lỗi này:
$ 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
Đây là những gì tôi nhận được khi tôi chạy 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: Đây là những gì tôi nhận được khi tôi chạy javac --version
:
$ javac --version
javac 9.0.1
Bất kỳ ý tưởng nào về cách sửa lỗi này?
bạn có thể chạy 'javac -version' quá trong thiết bị đầu cuối, vui lòng – bennygenel
Tôi vừa chỉnh sửa câu hỏi của mình với kết quả của lệnh đó. Cảm ơn! – Xar
Tôi tìm thấy [vấn đề này] (https://github.com/facebook/react-native/issues/11755) nó là một chút cũ nhưng có thể liên quan đến một trong hai phiên bản java hoặc gradle. – bennygenel