Inconsistent JVM-target compatibility Android Origin: On your device OSI layer 7 · Application Last updated 13 Oct 2026

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (1.8)

Java and Kotlin compile tasks target different JVM bytecode versions in the same module.

Exact message you may see Inconsistent JVM-target compatibility detected for tasks
Seen on: Android

Meaning

AGP 8 uses Java 17 toolchains while older templates set kotlinOptions.jvmTarget = "1.8". Set both to the same version (prefer a toolchain).

Common causes

  • compileOptions and kotlinOptions/jvmTarget differ
  • Library module with old settings
  • JDK upgrade changed defaults

⚡ Quick fix

  1. Use kotlin { jvmToolchain(17) }
  2. Or set compileOptions and jvmTarget to the same version in every module

Detailed fix by platform

Gradle

  1. kotlin
    kotlin { jvmToolchain(17) }
    android {
      compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
      }
    }

How to diagnose

  1. Module — Which module?
  2. Settings — compileOptions vs jvmTarget

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Android resource linking failed — AAPT: error: resource x (aka y) not found — Android resource linking failed (Android)Android resource link…android:attr/lStar not found — AAPT: error: resource android:attr/lStar not found (Android)android:attr/lStar no…Cannot fit requested classes in a single dex file — Cannot fit requested classes in a single dex file (# methods: 65536 > 65536) — mergeDex failed (Android)Cannot fit requested …Could not resolve — Gradle: Could not resolve all files for configuration / Could not resolve dependency (Android)Could not resolveDependency requires compileSdk — Dependency 'androidx.x:1.y' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Android)Dependency requires c…Dependency requires compileSdk 34 or later — Android Gradle: Execution failed for task ':app:checkDebugAarMetadata'. Dependency requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Flutter / Dart)Dependency requires c…Gradle task assembleDebug failed with exit code 1 — Flutter: Exception: Gradle task assembleDebug failed with exit code 1 (Flutter / Dart)Gradle task assembleD…incompatible version of Kotlin — Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.0.0, expected version is 1.8.0 (Android)incompatible version …Inconsist…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.