简体   繁体   中英

Could not determine java version from '11.0.1' when try to run gradle command

I am able to build my Android project from Android Studio. However, I am getting following error when I try to run a gradlew command. How can I resolve 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)$

This is my Java version:

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)

Upgrade to Gradle 4.7.

The Release Notes says:

Fixed issues

46 issues have been fixed in Gradle 4.7.

  • ...
  • [ #4515 ] - Support Java 11 Version Name
  • ...

You can either upgrade the Gradle version likes Andreas's answer or downgrade the java version if needed.

Follow the link to change JAVA_HOME to downgrade JAVA. How to set JAVA_HOME in Mac permanently?

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