# java.lang.UnsupportedClassVersionError: com/example/MyClass 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

- **ID:** `android/kotlin-unsupported-class-version`
- **Domain:** android
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

A dependency or project module is compiled with a higher Java bytecode version than the compileSdk or JVM target supports, causing a version mismatch at runtime or build time.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Android Gradle Plugin 7.4.0 | active | — | — |
| AGP 8.0.0 | active | — | — |
| AGP 8.1.0 | active | — | — |
| AGP 8.2.0 | active | — | — |
| Kotlin 1.8.0 | active | — | — |
| Kotlin 1.9.0 | active | — | — |
| Kotlin 2.0.0 | active | — | — |
| Java 11 | active | — | — |
| Java 17 | active | — | — |
| Java 21 | active | — | — |

## Workarounds

1. **Set the Java bytecode version in build.gradle (Module: app): android { compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = "11" } } Ensure the JDK used by Gradle is at least JDK 17 for class file version 61.0. Check with java -version in terminal.** (90% success)
   ```
   Set the Java bytecode version in build.gradle (Module: app): android { compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = "11" } } Ensure the JDK used by Gradle is at least JDK 17 for class file version 61.0. Check with java -version in terminal.
   ```
2. **If a dependency is compiled with Java 17 bytecode, update the Gradle JDK in Android Studio: File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK > select JDK 17 or higher. Then rebuild.** (92% success)
   ```
   If a dependency is compiled with Java 17 bytecode, update the Gradle JDK in Android Studio: File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK > select JDK 17 or higher. Then rebuild.
   ```
3. **Exclude the offending dependency and use a compatible version. For example, if a library requires bytecode 61.0, find an older version that targets 55.0: implementation('com.example:library:1.0.0') { exclude group: 'com.example' } Then add implementation 'com.example:library:0.9.0'.** (85% success)
   ```
   Exclude the offending dependency and use a compatible version. For example, if a library requires bytecode 61.0, find an older version that targets 55.0: implementation('com.example:library:1.0.0') { exclude group: 'com.example' } Then add implementation 'com.example:library:0.9.0'.
   ```

## Dead Ends

- **Set compileSdk to a higher value like 34 to force the build to accept newer bytecode** — compileSdk controls API level, not bytecode version; it does not affect class file version compatibility. (95% fail)
- **Add multiDexEnabled true to build.gradle** — MultiDex handles method count limits, not bytecode version issues. (99% fail)
- **Downgrade the Kotlin version to 1.6.0 to use older bytecode** — This may break newer Kotlin features and does not fix the dependency that is already compiled with a higher version. (80% fail)
