One or more classes has class file version >= 56 which is not officially supported.
当前电脑版本是 Android Studio Flamingo | 2022.2.1 Patch 1
这是由于使用JDK 17构建,而不是告诉它让Android兼容(即。( Java 11)。在为Android构建Java / Kotlin类时,需要生成兼容Java 11的字节码。您仍然可以使用JDK 17进行构建,但您需要告诉它将其拨回一点,而不是使用dexer无法处理的新内容。
// Pure Kotlin
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
jvmTarget = JavaVersion.VERSION_11.toString()
}
// Pure Java
tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
}
// Android
android {
compileOptio