ReactNative, Android running error: Could not determine java version from ‘11.0.1’ . Windows 10
Java version: 11.0.1
React Native version: 0.57.5
React Native CLI version: 2.0.1
The Android device is connected and given access to debug via USB
When I run neact-native run android, I get the following error:
Starting JS server… Build and install apps on your device (cd android & gradlew.bat installDebug)….
Failure: The build failed with an exception.
What went wrong:
The Java version could not be determined from “11.0.1”.Try:
Run with the –stacktrace option to get a stack trace. Run with the –info or –debug options for more log output. Run with –scan to get a complete insight.Get more help at https://help.gradle.org
Unable to install the app on the device, read the error above for details.
Make sure that you are running an Android emulator or a connected device, and
Set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Solution
It seems that you are using an older version of Gradle and your project should build from 4.8+
The following directory gradle/
is in the directory where gradlew or gradlew
.bat
is located.
- Edit the file named gradle-wrapper.properties in
./path-to-project-root/gradle/wrapper
- Replace
distributionUrl:...
with the following
distributionUrl=http\://services.gradle.org/distributions/gradle-5.0-bin.zip