Java – Unable to determine java version from ‘11.0.1’ when trying to run the gradle command

Unable to determine java version from ‘11.0.1’ when trying to run the gradle command… here is a solution to the problem.

Unable to determine java version from ‘11.0.1’ when trying to run the gradle command

I was able to build my Android project from Android Studio. However, when I try to run the gradlew command, I get the following error. How do I fix this?

admin:(my/branch)$ ./gradlew clean assembleDebug --stacktrace

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
admin:(my/branch)$

Here is my version of Java:

admin:(my/branch)$ java -version
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

Solution

Upgrade to Gradle 4.7.

Release Notes says

Fixed issues

46 issues have been fixed in Gradle 4.7.

  • [#4515] – Support Java 11 Version Name

Related Problems and Solutions