Beyond JDK support, why must you also align Gradle with the Kotlin Gradle plugin and Android Gradle Plugin (AGP) versions, and how do you find a compatible set?
answer
- Gradle JDK matrix is one axis only
- KGP and AGP have own Gradle ranges
- AGP strictest: min Gradle + required JDK
- find the intersection of all tables
- 'minimum supported Gradle version is X' error
basics
~10 sEach Kotlin plugin and AGP version supports only a range of Gradle versions. Check their own compatibility tables, not just Gradle's JDK matrix, and pick a set where all three overlap.
solid answer
~50 sGradle's JDK matrix is only one axis. The **Kotlin Gradle Plugin (KGP)** and **Android Gradle Plugin (AGP)** each publish their own compatibility tables stating the minimum/maximum Gradle they work with and which JDK they require. AGP is the strictest: a given AGP version has both a *minimum Gradle* and a required *JDK for running* (e.g. AGP 8.x needs JDK 17 to run and Gradle 8.x). KGP similarly maps Kotlin versions to supported Gradle ranges. So a real upgrade is a four-way alignment: Gradle ↔ run-on JDK ↔ KGP ↔ AGP. The method: start from the constraint that's hardest to move (often AGP, tied to the Android tooling), read its table for the required Gradle and JDK, then confirm Gradle's own matrix and KGP's table all overlap. If they don't intersect, you stage the upgrade. Trying to bump one in isolation produces cryptic plugin-loading or 'minimum supported Gradle version is X' errors.
code
kotlin · 6 linesplugins {
// Cross-check EACH plugin's supported-Gradle range,
// not just Gradle's JDK matrix.
id("org.jetbrains.kotlin.jvm") version "2.0.0" // KGP -> supported Gradle range
id("com.android.application") version "8.5.0" // AGP -> min Gradle + required JDK
}go deeper
Know that Kotlin/AGP plugins also have version constraints, not just Gradle.
Explain the multi-axis alignment and how to find an intersecting set.
Discuss starting from the strictest constraint (AGP) and staged multi-axis bumps.
Standardize a known-good Gradle/KGP/AGP/JDK quad via version catalogs across all repos.
## Compatibility is multi-axis Upgrading Gradle safely in a Kotlin or Android project means satisfying *several* compatibility tables at once, not just Gradle↔JDK. ### The axes 1. **Gradle ↔ JDK (run-on)** — Gradle's own matrix. 2. **Kotlin Gradle Plugin ↔ Gradle** — each Kotlin version supports a range of Gradle versions (and may warn or fail outside it). 3. **Android Gradle Plugin ↔ Gradle ↔ JDK** — AGP is the strictest. Each AGP version states a *minimum Gradle* and the *JDK required to run the build* (AGP 7.x → JDK 11, AGP 8.x → JDK 17). 4. **AGP ↔ Kotlin** — Android projects also need KGP and AGP to agree. ### Finding a compatible set Work from the **least flexible constraint outward** — usually AGP, because it is pinned to the Android SDK/tooling you must ship against: 1. Read AGP's compatibility table → it gives the minimum Gradle and required JDK. 2. Check Gradle's matrix → confirm that Gradle runs on that JDK. 3. Check KGP's table → confirm your Kotlin version supports that Gradle. 4. The answer is the intersection. If empty, you must move more than one axis (e.g. bump AGP *and* Gradle *and* Kotlin together). ### Symptoms of misalignment - `The minimum supported Gradle version is 8.x. Current version is 7.y` (AGP/KGP rejecting Gradle). - Plugin fails to apply or throws `NoSuchMethodError` against a Gradle API removed/changed across versions. - Kotlin compiler daemon warnings about an unsupported Gradle. ### Why a single bump breaks These plugins compile against specific Gradle APIs. A too-new or too-old Gradle changes those APIs, so the plugin either refuses to load (explicit minimum check) or fails at runtime. The compatibility tables are the contract; the JDK matrix alone is insufficient. ```kotlin plugins { // Each of these has its OWN supported-Gradle range to cross-check id("org.jetbrains.kotlin.jvm") version "2.0.0" id("com.android.application") version "8.5.0" } ```
- Which of Gradle, KGP, and AGP is usually the least flexible constraint, and why?AGP, because it is tied to the Android SDK/build tooling you must target, and it imposes both a minimum Gradle and a required run-on JDK.
- What does 'The minimum supported Gradle version is 8.x' mean?A plugin (often AGP/KGP) explicitly rejects your current, older Gradle; bump Gradle to at least that version.
saying these in an interview costs you the question
- Assuming Gradle's JDK matrix alone guarantees a working build for Android/Kotlin.
- Bumping Gradle in isolation without checking the plugin tables.