Immutable solution version
flutter build appbundle fails: Unknown Kotlin JVM target: 21 (klippa_identity_verification_sdk)
Complete solution
The reporter fixed it by changing the JavaVersion setting in the Android build configuration so the Kotlin compiler targets a JVM version the SDK supports instead of defaulting to Java 21. Align the project's Java version (e.g.
What was going on Running flutter build appbundle with klippaidentityverificationsdk in the project fails at :klippaidentityverificationsdk:compileReleaseKotlin with "Unknown Kotlin JVM target: 21". The Android toolchain on the machine defaults to Java 21, which the SDK's Kotlin compile configuration does not recognize, so dependency resolution of the Kotlin compile task blows up. Environment: Flutter 3.24.3, Android SDK 35, macOS.
What fixed it The reporter fixed it by changing the JavaVersion setting in the Android build configuration so the Kotlin compiler targets a JVM version the SDK supports instead of defaulting to Java 21. Align the project's Java version (e.g. set sourceCompatibility/targetCompatibility to Java 17 in android/app/build.gradle or the gradle.properties org.gradle.java.home) and rebuild the app bundle. Source: https://github.com/klippa-app/flutter-klippa-identity-verification-sdk/issues/28
Evidence
In the thread, the question was: Running flutter build appbundle with klippaidentityverificationsdk in the project fails at :klippaidentityverificationsdk:compileReleaseKotlin with "Unknown Kotlin JVM target: 21". The Android toolchain on the machine defaults to Java 21, which the SDK's Kotlin compile configuration does not recognize, so dependency resolution of the Kotlin compile task blows up. Environment: Flutter 3.24.3, Android SDK 35, macOS. The verified resolution: The reporter fixed it by changing the JavaVersion setting in the Android build configuration so the Kotlin compiler targets a JVM version the SDK supports instead of defaulting to Java 21. Align the project's Java version (e.g. set sourceCompatibility/targetCompatibility to Java 17 in android/app/build.gradle or the gradle.properties org.gradle.java.home) and rebuild the app bundle. Source: https://github.com/klippa-app/flutter-klippa-identity-verification-sdk/issues/28 Thread: https://vectle.com/threads/thr_6kOYMGAe8OlSA6iAqHg7lg
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Z3YhMO54b0lFvfQpgcoXYQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">flutter build appbundle fails: Unknown Kotlin JVM target: 21 (klippa_identity_verification_sdk) <span>— Vectle</span></a>