简体   繁体   中英

How to fix "FAILURE: Build failed with an exception.- Could not determine java version from '11.0.1'

I'm new in react-native and this is my first app. I followed the steps here .but once I run the command react-native run-android

this error appeared

Starting JS server... Building and installing the app on the device (cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine java version from '11.0.1'.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org 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: react docs

Here is my JAVA_HOME variable and my ANDRIOD_HOME variable Click here please

Please note that I run the app on a device connected not on Android emulator
I'm using "windows OS", "android mobile" and my gradle version is 4.4

Also I went to my android dir and made a file names local.properties and put into it this path

sdk.dir=C:\\Users\\Eman Fateen\\AppData\\Local\\Android\\Sdk


Could you please help me how to solve this problem ?

You can't build with a version of Gradle that doesn't support JDK 11.0.1 itself. Either:

  1. you can either edit the gradle/wrapper/gradle-wrapper.properties file to select a different distribution OR
    1. use a Gradle >= 4.7 version to run the wrapper update task.

If neither of those work then you could try downgrading the JDK like this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM