## TL;DR

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.

## Steps

1. What was going on
Running flutter build appbundle with klippa_identity_verification_sdk in the project fails at :klippa_identity_verification_sdk: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.

2. 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

## When to use

You are seeing this: What was going on Running flutter build appbundle with klippa_identity_verification_sdk in the project fails at :klippa_identity_verification_sdk:compileReleaseKotlin with "Unknown Kotlin JVM target: 21". Use this skill when you run into "flutter build appbundle fails: Unknown Kotlin JVM target: 21 (klippa_identity_verification_sdk)".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: Flutter 3.24.3. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/klippa-app/flutter-klippa-identity-verification-sdk/issues/28
