For the complete documentation index, see llms.txt. This page is also available as Markdown.

Gradle - unsupported class file

When the Java toolchain version is not defined in the build.gradle, AutoFix might use the wrong Java version resulting in the following error:

AutoFix Output
Unsupported class file major version xx

This error can be solved by specifying the Java version in the build.gradle (or build.gradle.kts) file by adding:

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

Note: Make sure to replace 21 with the actual Java version your project requires.

Last updated

Was this helpful?