{
  "id": "android/compile-sdk-version-mismatch",
  "signature": "Execution failed for task ':app:compileDebugKotlin'. > 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.",
  "signature_zh": "任务':app:compileDebugKotlin'执行失败。'compileDebugJavaWithJavac'任务（当前目标1.8）和'compileDebugKotlin'任务（当前目标11）的JVM目标兼容性应设置为相同的Java版本。",
  "regex": "jvm target compatibility should be set to the same Java version",
  "domain": "android",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Mismatch between Java and Kotlin JVM target versions in build.gradle, causing compilation incompatibility.",
  "root_cause_type": "generic",
  "root_cause_zh": "build.gradle中Java和Kotlin的JVM目标版本不匹配，导致编译不兼容。",
  "versions": [
    {
      "version": "Kotlin 1.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android Gradle Plugin 8.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Only changing compileSdk version in build.gradle without adjusting Java/Kotlin targets",
      "why_fails": "compileSdk is separate from JVM target; does not resolve version mismatch error.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting both Java and Kotlin targets to 1.6 (deprecated) in hope of backward compatibility",
      "why_fails": "AGP 8.0+ requires minimum Java 8; 1.6 is unsupported and causes other errors.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "In build.gradle (app level), set both targets: android { compileOptions { sourceCompatibility JavaVersion.VERSION_11; targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = '11' } }",
      "success_rate": 0.95,
      "how": "In build.gradle (app level), set both targets: android { compileOptions { sourceCompatibility JavaVersion.VERSION_11; targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = '11' } }",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using Java 8, align both to 8: kotlinOptions { jvmTarget = '1.8' } and compileOptions { sourceCompatibility JavaVersion.VERSION_1_8; targetCompatibility JavaVersion.VERSION_1_8 }",
      "success_rate": 0.9,
      "how": "If using Java 8, align both to 8: kotlinOptions { jvmTarget = '1.8' } and compileOptions { sourceCompatibility JavaVersion.VERSION_1_8; targetCompatibility JavaVersion.VERSION_1_8 }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "In build.gradle (app level), set both targets: android { compileOptions { sourceCompatibility JavaVersion.VERSION_11; targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = '11' } }",
    "If using Java 8, align both to 8: kotlinOptions { jvmTarget = '1.8' } and compileOptions { sourceCompatibility JavaVersion.VERSION_1_8; targetCompatibility JavaVersion.VERSION_1_8 }"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kotlinlang.org/docs/gradle.html#targeting-the-jvm",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-04-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}