Unsupported class file major version ##

I’m trying to compile my first APK I’m getting the dreaded Unsupported class error. According to the Gradle compatibility matrix 9.0.3 it’s supposed to be compatible with Java 25 (aka 69) … Except it’s apparently not.

I downgraded Java to 24. All that did was change the error message to “68”.

So what version of JDK is really required to make Gradle compile an APK?

Mind sharing the full error, optimally using a build --scan URL?
Assuming you mean 9.3.0, not 9.0.3 which does not exist, you have seen in the compatibility matrix that Gradle itself is perfectly fine with Java 25 or 24.
But that does not mean that other tools you use are compatible with that.

Sorry, it is 9.3.0

Gradle is being invoked by Cordova with “cordova build android” as directed in numerous tutorials. I’m not sure where to add the –scan command when Gradle is run by Cordova.

The first build process succeeds with a deprecation warning about fs.F_OK

When it starts the second build process Gradle throws:

BUG! exception in phase ‘semantic analysis’ in source unit ‘BuildScript’ Unsupported class file major version 68 

>Unsupported class file major version 68

Now what? Am I looking for a Cordova build script that’s wrong?

I have no idea, this is a Gradle forum, not a Cordova forum.

According to Android Platform Guide - Apache Cordova it might maybe be cordova build android -- --gradleArg=--scan.

Besides that, I still need more of the error output to say anything.

Well know I know how to pass arguments to Gradle. Thanks for that.

And, that lets me share the debug data:

Never having installed Gradle until yesterday and having installed 9.3.0 from this site, I’m puzzled as to where 8.13 came from.

E:\TyranoStudio_win_std_v120\export\TheBigThawAPK\TheBigThaw>gradle

> Task :help--> 0% INITIALIZING [101ms]

Welcome to Gradle 9.3.0.

Since clearly there can be two versions installed, are there “strip all of it out and start over” docs someplace?

Wait it’s downgrading it’s self when launched … Arrrgh. That’s what I get for following a tutorial.

E:\TyranoStudio_win_std_v120\export\TheBigThawAPK\TheBigThaw>cordova build android
Checking Java JDK and Android SDK versions
ANDROID_HOME=undefined (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: C:\Users\Charles Taylor\AppData\Local\Android\sdk

Welcome to Gradle 9.3.0!

Here are the highlights of this release:

Test reporting improvements

Error and warning improvements

Build authoring improvements

For more details see 


Starting a Gradle Daemon (subsequent builds will be faster)

BUILD SUCCESSFUL in 7s
1 actionable task: 1 up-to-date
Consider enabling configuration cache to speed up this build: 

Subproject Path: CordovaLib
Subproject Path: app
(node:7692) [DEP0176] DeprecationWarning: fs.F_OK is deprecated, use fs.constants.F_OK instead
(Use node --trace-deprecation ... to show where the warning was created)
Downloading https://services.gradle.org/distributions/gradle-8.13-bin.zip
…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%

Welcome to Gradle 8.13!


Welcome to Gradle 8.13 … wait what? I guess I need to figure out what crazy Cordova is doing to Gradle and why it’s provoking a downgrade.

If any build uses the installed version, it has a build bug.
You should usually never have any Gradle version installed.
Each sane build has the four Gradle Wrapper files checked in.
These files define the Gradle version this build is compatible with and should run with and auto-provisions and uses this exact version.
Probably Cordova uses your installed Gradle version to bootstrap a new Gradle build with the Gradle version it knows how to handle.

Whether Cordova can also use a different version again is not a question for the Gradle community, but for someone knowing what Cordova is and does. :slight_smile: