AGP 9.0 Forces a New DSL, Built-in Kotlin, and Stricter R8 Rules
This upgrade is a forced march off deprecated APIs with a ticking clock: the opt-out flag vanishes in AGP 10.0. Teams that delay will face a compressed migration window in 2026, while the R8 keep-rule and companion-method changes can silently alter runtime behavior on older API levels.
AGP 9.0 removes the old `BaseExtension` DSL and requires all variant access to go through `androidComponents.onVariants`. A temporary `newDsl=false` escape hatch exists in `gradle.properties` but disappears in AGP 10.0, expected mid-2026. Kotlin is now built into the plugin at version 2.2.10; projects that need a different KGP version must explicitly disable the built-in support and pin a strict version, with a floor of 2.0.0.
Eighteen Gradle properties flip their defaults. Among the most impactful: `android.useAndroidx` and `android.uniquePackageNames` become true, `android.enableAppCompileTimeRClass` forces a switch-to-if-chain refactor, and `android.r8.strictFullModeForKeepRules` demands explicit constructor keep rules. R8 also gains a `-processkotlinnullchecks` option that can strip null-check messages or remove checks entirely, and keep rules no longer propagate to companion methods, which breaks interface desugaring below API 24.
Several features are gone outright: Wear OS embedded apps, density-split APKs, the `androidDependencies` task, and the `PostProcessing` block. The `CommonExtension` parameterization is removed, pushing block methods into `ApplicationExtension`, `LibraryExtension`, and their peers — a source-level break that touches any custom build logic.
Bundling Kotlin into AGP ends the separate KGP version-management dance but creates a lockstep coupling: an AGP upgrade now drags in a Kotlin compiler upgrade whether the project is ready or not.
The removal of keep-rule propagation to companion methods is a subtle desugaring trap. Projects with `minSdk < 24` that rely on interface keep rules may find methods stripped without a clear build error.
Flipping `android.enableAppCompileTimeRClass` to true by default forces every `switch` on resource IDs to become an `if` chain — a mechanical refactor that touches a lot of code for no functional gain, purely to satisfy the compiler.
The opt-out window is deliberately narrow: AGP 9.0 ships the escape hatch, 9.4 adds per-module control, and 10.0 kills it. Google is signaling that the old DSL is dead and teams should budget the migration now, not in 2026.