Inconsistent JVM-target compatibility 🤖 Android

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.

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:

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