Android Studio 开发环境兼容性检索(AGP / Gradle / Kotlin / JDK)

发布于:2025-05-27 ⋅ 阅读:(69) ⋅ 点赞:(0)

本表检索了 Android 项目中常用构建工具的兼容性关系,包括:

  • AGP(Android Gradle Plugin)
  • Gradle(构建工具)
  • KGP(Kotlin Gradle Plugin)
  • JDK(Java Development Kit)
  • compileSdkVersion(编译 API 上限)

📊 全版本兼容性总表

AGP 版本 最低 Gradle 最高 Gradle Kotlin 插件版本范围 最低 JDK 支持的 compileSdk 状态
3.6.x 5.6.4 6.5 1.3.x – 1.4.x JDK 8 ≤ 29(Android 10) ❌ 过时
4.0.x 6.1.1 6.5 1.3.x – 1.4.x JDK 8 ≤ 30 ❌ 过时
4.1.x 6.5 6.7.1 1.4.x – 1.5.x JDK 8 ≤ 30 ❌ 过时
4.2.x 6.7.1 6.9 1.4.x – 1.5.x JDK 8 ≤ 30 ⚠️ 部分兼容
7.0.x 7.0 7.2 1.5.x – 1.6.x JDK 11 ≤ 31(Android 12) ✅ 稳定
7.1.x 7.2 7.3 1.5.x – 1.6.x JDK 11 ≤ 32 ✅ 稳定
7.2.x 7.3 7.4 1.6.x – 1.7.x JDK 11 ≤ 32/33 ✅ 稳定
7.3.x 7.4 7.5 1.7.x – 1.8.x JDK 11 ≤ 33(Android 13) ✅ 稳定
7.4.x 7.5 7.6 1.8.x – 1.9.x JDK 11 ≤ 33 ✅ 推荐
8.0.x 8.0 8.1 1.8.x – 1.9.x JDK 17 ≤ 34(Android 14) ✅ 推荐
8.1.x 8.1 8.2 1.9.x – 2.0.x JDK 17 ≤ 34 ✅ 推荐
8.2.x 8.2 8.3 1.9.22 – 2.0.x JDK 17 ≤ 34 ✅ 稳定
8.3.x 8.3 8.4 2.0.x – 2.1.x JDK 17 ≤ 35(Android 15) ✅ 最新
8.10.0+ 8.11.1 8.12+ 2.1.x JDK 17 ≥ 34 / 35+ ✅ 最新

✅ 推荐构建组合(2025)

✔ 稳定生产环境推荐

# gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
// build.gradle
plugins {
    id 'com.android.application' version '8.2.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
}
  • JDK:17
  • compileSdk:34

✔ 最新功能体验环境(适用于 Jetpack Compose 1.6+ 、Android 15)

# gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
// build.gradle
plugins {
    id 'com.android.application' version '8.10.0' apply false
    id 'org.jetbrains.kotlin.android' version '2.1.20' apply false
}
  • JDK:17
  • compileSdk:35

📌 常见注意事项

  • AGP ≥ 8.0 必须使用 JDK 17
  • Gradle 与 AGP 是强绑定关系,版本不兼容会构建失败
  • Kotlin 插件版本应与 Kotlin 编译器一致,否则 kapt 、Compose 等可能异常
  • 已废弃配置项(如 android.bundle.enableUncompressedNativeLibs)在 AGP 8.1+ 已移除

网站公告

今日签到

点亮在社区的每一天
去签到