7

I have the following error when I try to build on Gradle:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '14.0.1'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

I have Gradle 6.3 installed. The build uses the Gradle wrapper using Gradle 5.1.1. Do i have to downgrade Java?

thokuest
  • 5,800
  • 24
  • 36
Denu Lemos
  • 83
  • 1
  • 2
  • 7
  • 1
    Duplicate: [Gradle: Could not determine java version from '11.0.2'](https://stackoverflow.com/questions/54358107/gradle-could-not-determine-java-version-from-11-0-2) Same situation with different gradle-wrapper and systemwide gradle versions, where the gradle wrapper version is an older one (5.1.1) that doesn't support Java 14. – tryman Jun 17 '20 at 15:09

2 Answers2

6

As per Gradle release notes (Link):

Compatibility Notes

A Java version between 8 and 13 is required to execute Gradle. Java 14 and later versions are not yet supported.

Java 6 and 7 can still be used for compilation and forked test execution. Just like Gradle 5.x, any supported version of Java can be used for compile or test.

I think you need to downgrade your Java version.

Community
  • 1
  • 1
saurabh1489
  • 324
  • 1
  • 6
  • As per OP's comment the build is using Gradle 5.1.1 which [supports Java 11](https://docs.gradle.org/5.0/release-notes.html#java-11-runtime-support) only. – thokuest Apr 24 '20 at 19:56
  • What a mess. How would you even go about getting an older version of Gradle if you needed it? – Edward Falk Aug 26 '21 at 20:55
1

Is suspicious in not reporting a Gradle version.

Could you add the output of .gradlew -version on your machine? My first guess would be that you have a Linux distribution packaged version of Gradle which is usually a rebuilt version with selected patches and not something that matches the official Gradle releases.

In addition, when looking at the thrift repo gradle wrapper I see they are still using 5.1.1 which was not Java 12 compatible. You need at least Gradle 5.4.

for more info https://github.com/gradle/gradle/issues/10804

  • Hello! My gradlew output was => `------------------------------------------------------------ Gradle 5.1.1 ------------------------------------------------------------ Build time: 2019-01-10 23:05:02 UTC Revision: 3c9abb645fb83932c44e8610642393ad62116807 Kotlin DSL: 1.1.1 Kotlin: 1.3.11 Groovy: 2.5.4 Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018 JVM: 14.0.1 (Oracle Corporation 14.0.1+7) OS: Windows 10 10.0 amd64 ` – Denu Lemos Apr 24 '20 at 15:37