Charlie Tapping
04/14/2023, 11:44 AMandroidx/compose/compiler/plugins/kotlin/ComposeComponentRegistrar has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0.
55 Being Java 11 and 61 being 17 (I guess the latest compose was compiled on a machine with 17)
Now Gradle is running with Java 18
I’ve set the toolchain to use 18 with:
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.compile.version.get().toInt())) //compile = 18
vendor.set(JvmVendorSpec.ADOPTIUM)
}
}
I’ve set the kotlin compile tasks to output Java 11 bytecode:
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(libs.versions.java.bytecode.version.get())) bytecode = 11
}
}
On AGP I configured the same
compileOptions {
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.bytecode.version.get().toInt())
targetCompatibility = JavaVersion.toVersion(libs.versions.java.bytecode.version.get().toInt())
}
kotlinOptions {
jvmTarget = libs.versions.java.bytecode.version.get()
}
I really don’t understand how I could be running Java 11 runtime, its like kapt is reading the jvmTarget as the runtime rather than the bytecode target?Hackintoshfive
04/14/2023, 1:24 PM$JAVA_HOME/bin/java --version
and java --version
Charlie Tapping
04/14/2023, 1:27 PMHackintoshfive
04/14/2023, 6:44 PMgradle --stop
fixed it