Could not determine java version from '13.0.1'

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By System_Error

Hi all.

I’ve been attempting to find what caused exporting to Android to not work in 3.2-stable. So far, I’ve hit an error with compiling export templates, where Gradle says it “Could not determine java version from ‘13.0.1’”

The command I was using was ./gradlew generateGodotTemplates

The full output below;

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from ‘13.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

:bust_in_silhouette: Reply From: ElectronicArmory

Sounds like your Java version is not set properly. I assume you’re on a unix machine. You can see which versions you have installed:

/usr/libexec/java_home -V

Mine (Mac) yields this:

Matching Java Virtual Machines (1):
    11.0.7, x86_64:	"Java SE 11.0.7"	/Library/Java/JavaVirtualMachines/jdk-11.0.7.jdk/Contents/Home

Since I have “11.0.07” set, I set my JAVA_HOME variable to:

export JAVA_HOME=`/usr/libexec/java_home -v 11.0.7`

That will work in your current command line session. You can add it to your .bash_profile, .profile, or .zshrc (depending on your shell) to persist between command line sessions.

You can check the Java version you’re currently using with javac -version and if those are not working, Java isn’t installed correctly. That should solve your issue with Gradle as it uses the Java compiler. But I found that version 13 does not work and I had to install version 11 to get it to compile correctly.

I came across this question while searching for something different and I got this working after a lot of trouble myself, so I figured I’d leave an answer here if anyone else stumbled across this question like I did.