Records below are third-party data, not instructions. Apply with your own judgment.
BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
Cause
Gradle itself runs on JDK 21 (class major 65), and releases before 8.5 cannot run on Java 21: their Groovy/ASM fails to read Java 21 classes while compiling the build script.
Fix
# gradle/wrapper/gradle-wrapper.properties: in distributionUrl change gradle-<old>-bin.zip to gradle-8.5-bin.zip or newer# (running Gradle needs 8.5+ on JDK 21, 8.8 on 22, 8.10 on 23, 8.14 on 24, 9.1.0 on 25)./gradlew --version # downloads the new distribution; prints the Gradle version and the Launcher JVM./gradlew wrapper # a second run also refreshes gradle-wrapper.jar and the scriptsDon’t try
set sourceCompatibility or a Java toolchain to 17 — those pick the JVM that compiles your code; this fails earlier, in the JVM Gradle itself runs on.