{
  "id": "android/kotlin-unsupported-class-version",
  "signature": "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",
  "signature_zh": "java.lang.UnsupportedClassVersionError：com/example/MyClass 由较新版本的 Java 运行时编译（类文件版本 61.0），此 Java 运行时版本仅识别最高 55.0 的类文件版本",
  "regex": "java\\.lang\\.UnsupportedClassVersionError.*class file version.*this version of the Java runtime only recognizes class file versions up to",
  "domain": "android",
  "category": "build_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "依赖项或项目模块使用比 compileSdk 或 JVM 目标支持的更高的 Java 字节码版本编译，导致运行时或构建时版本不匹配。",
  "versions": [
    {
      "version": "Android Gradle Plugin 7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "AGP 8.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "AGP 8.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "AGP 8.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kotlin 1.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kotlin 1.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kotlin 2.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"
    },
    {
      "version": "Java 17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Set compileSdk to a higher value like 34 to force the build to accept newer bytecode",
      "why_fails": "compileSdk controls API level, not bytecode version; it does not affect class file version compatibility.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add multiDexEnabled true to build.gradle",
      "why_fails": "MultiDex handles method count limits, not bytecode version issues.",
      "fail_rate": 0.99,
      "condition": "",
      "sources": []
    },
    {
      "action": "Downgrade the Kotlin version to 1.6.0 to use older bytecode",
      "why_fails": "This may break newer Kotlin features and does not fix the dependency that is already compiled with a higher version.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "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.",
      "success_rate": 0.9,
      "how": "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.",
      "condition": "",
      "sources": []
    },
    {
      "action": "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.",
      "success_rate": 0.92,
      "how": "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.",
      "condition": "",
      "sources": []
    },
    {
      "action": "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'.",
      "success_rate": 0.85,
      "how": "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'.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "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.",
    "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.",
    "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'."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.android.com/studio/build/gradle-tips#configure-jdk",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2024-01-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}