From ec3e9be02ede26cee85b74b1287223ca15939ceb Mon Sep 17 00:00:00 2001 From: reidbaker-agent <269567208+reidbaker-agent@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:50:17 -0500 Subject: [PATCH 1/9] [Android] Add Flutter 3.50 breaking-change guide for build tool minimums --- .../android-build-tool-minimum-versions.md | 288 ++++++++++++++++++ .../content/release/breaking-changes/index.md | 2 + 2 files changed, 290 insertions(+) create mode 100644 sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md new file mode 100644 index 0000000000..056a8e5ea6 --- /dev/null +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -0,0 +1,288 @@ +--- +title: Raised minimum Android build tool versions +description: >- + Flutter 3.50 requires Android Gradle Plugin 9.1.1, Gradle 9.3.1, + and Kotlin Gradle Plugin 2.4.10 (when applied) or later to build for Android. + Android Gradle Plugin 10 isn't supported. +--- + +{% render "docs/breaking-changes.md" %} + +## Summary + +To build a Flutter app, module, or plugin for Android, Flutter 3.50 requires +newer minimum versions of the Android build tools than Flutter 3.47 required. +Builds that resolve below these minimums—or configure Android Gradle Plugin +(AGP) 10 or later—fail with an error naming the dependency and required +version. + +The following table compares the minimum, warning, and template default +versions between Flutter 3.47 and Flutter 3.50: + +| Dependency | Flutter 3.47 minimum | Flutter 3.50 minimum | Warns below (3.50) | New project default (3.50) | +| :--- | :--- | :--- | :--- | :--- | +| Android Gradle Plugin (AGP) | 8.11.1 | **9.1.1** | 9.3.1 | 9.3.1 | +| Gradle | 8.14.0 | **9.3.1** | 9.5.0 | 9.5.0 | +| Kotlin Gradle Plugin (KGP) | 2.2.20 | **2.4.10** | 2.4.20 | 2.4.20 | +| Java (JDK) | 17 | 17 | 17 | — | + +Flutter skips the KGP version check when your project uses AGP's +[built-in Kotlin][] (`android.builtInKotlin=true`). +With `android.builtInKotlin=false` +(refer to [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]), +the Flutter Gradle Plugin depends on KGP `2.4.10` and applies `kotlin-android` +when KGP is on the build classpath. +Gradle resolves lower unpinned KGP declarations up to `2.4.10`, +logging a `< 2.4.20` warning instead of failing the build +(even without Kotlin source files). + +Flutter 3.50 doesn't support AGP 10 or later. +Projects configured with AGP 10 fail validation until a future Flutter release +adds AGP 10 support. + +Default Android SDK and NDK values are unchanged from Flutter 3.47: +`compileSdk` is `36`, `targetSdk` is `36`, `minSdk` is `24`, +and the default NDK version is `28.2.13676358`. +Setting `minSdk` to `23` logs a warning, and `22` or lower fails the build. + +:::warning Projects created with Flutter 3.44 or 3.47 need manual updates +Unmodified projects created with Flutter 3.44 or Flutter 3.47 fail to build on +Flutter 3.50 until you update their Gradle files. +Neither `flutter upgrade` nor `flutter build` updates these tool versions: + +- **Flutter 3.44 templates** used Gradle `9.1.0` and AGP `9.0.1`. + Both are below the Flutter 3.50 minimums, so update Gradle to at least + `9.3.1` and AGP to at least `9.1.1`. +- **Flutter 3.47 templates** used AGP `9.1.0`, which is below the minimum, + so update AGP to at least `9.1.1`. + Their Gradle version (`9.3.1`) meets the minimum and logs a warning. + +Both templates also declared an older KGP (`2.3.20` in 3.44, `2.4.0` in 3.47). +Flutter 3.50's Gradle plugin resolves KGP up to `2.4.10`, +so the build logs a warning rather than failing on KGP until you declare KGP +`2.4.20` or later. +Update to the Flutter 3.50 template versions (`AGP 9.3.1`, `Gradle 9.5.0`, and +`KGP 2.4.20`) in the [migration guide](#migration-guide) to clear all warnings. +::: + +## Background + +Flutter checks your Gradle, Java, AGP, and KGP versions on every Android build +and enforces a [support policy][] for these tools. +Under that policy, Flutter marks a version as "warn" for at least one stable +release before raising the minimum ("error") in a later release. +In Flutter 3.50, AGP `9.0.1` through `9.1.0`, Gradle `9.1.0` through `9.3.0`, +and KGP `2.3.20` through `2.4.9` fail validation without a prior warning in +Flutter 3.47. +Flutter 3.47 warned only below AGP `9.0.1`, Gradle `9.1.0`, and KGP `2.3.20`. + +Flutter 3.50 raises the minimum versions for two reasons: + +- Requiring AGP 9 means every project builds with AGP 9's API surface. + The Flutter Gradle Plugin uses public AGP 9 APIs instead of maintaining + separate code paths for AGP 8 and AGP 9. +- AGP `9.1.1` and later support `compileSdk` 37 (Android 17), + preparing Flutter to target Android 17 in a future release without another + minimum version bump. + +According to the [AGP roadmap][], AGP 10 removes the legacy DSL, +the legacy variant APIs, and the `android.newDsl=false` opt-out that Flutter +sets for projects. +Because Flutter hasn't been validated against AGP 10, +Flutter 3.50 rejects AGP 10 builds cleanly before Gradle configuration fails: + +```plaintext noHighlight +Error: Your project's Android Gradle Plugin version (10.0.0) is not yet +supported. Flutter does not support Android Gradle Plugin 10, and support +will be added in a future Flutter release. Please downgrade your +Android Gradle Plugin version to a version below 10.0.0 to continue. +Alternatively, use the flag "--android-skip-build-dependency-validation" +to bypass this check (unsupported; your build may fail). +``` + +When a dependency version falls below the minimum, +the build fails with a validation error naming the required version: + +```plaintext noHighlight +Error: Your project's Android Gradle Plugin version (Android Gradle Plugin +version 9.1.0) is lower than Flutter's minimum supported version of +Android Gradle Plugin version 9.1.1. Please upgrade your Android Gradle +Plugin version. +Alternatively, use the flag "--android-skip-build-dependency-validation" +to bypass this check. +``` + +## Migration guide + +No changes are required to pass validation when your project uses AGP `9.1.1` +through `9.x`, Gradle `9.3.1` or later, and Java `17` or later +(without pinning KGP below `2.4.10`). +To clear deprecation warnings, use AGP `9.3.1` or later, Gradle `9.5.0` or +later, and either [built-in Kotlin][] or KGP `2.4.20` or later. + +### Check your versions + +Check the build files and toolchain settings in your Flutter project: + +- **AGP and KGP:** Inspect the `plugins {}` block in your + `android/settings.gradle.kts` (or `android/settings.gradle`) file. + Projects created before Flutter 3.16 declare these versions in the + `buildscript` block of `android/build.gradle`. +- **Gradle:** Inspect the `distributionUrl` line in your + `android/gradle/wrapper/gradle-wrapper.properties` file. +- **Java (JDK):** Run `flutter doctor -v` and check the Java version listed + under the Android toolchain section. + +Running `flutter analyze --suggestions` checks cross-tool compatibility between +Java, Gradle, AGP, and KGP (printing `compatible java/gradle/agp/kgp` when +valid), rather than Flutter's minimum thresholds. + +### Update the Android Gradle Plugin + +Update AGP to `9.3.1` (the default for Flutter 3.50 project templates) to avoid +the deprecation warning, or to at least `9.1.1`. + +Projects created with Flutter 3.16 or later declare AGP in the `plugins {}` +block of `android/settings.gradle.kts` (or `android/settings.gradle`): + +```kotlin diff title="/android/settings.gradle.kts" +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" +- id("com.android.application") version "9.1.0" apply false ++ id("com.android.application") version "9.3.1" apply false + id("org.jetbrains.kotlin.android") version "2.4.0" apply false +} +``` + +Projects created before Flutter 3.16 declare AGP as a `classpath` dependency +in `android/build.gradle`: + +```groovy diff title="/android/build.gradle" +buildscript { + dependencies { +- classpath 'com.android.tools.build:gradle:8.11.1' ++ classpath 'com.android.tools.build:gradle:9.3.1' + } +} +``` + +If you're upgrading from AGP 8, also refer to +[Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. + +### Update Gradle + +Update the Gradle wrapper in your +`android/gradle/wrapper/gradle-wrapper.properties` file. +Flutter recommends Gradle `9.5.0`. +Each AGP version requires a minimum Gradle version: +AGP `9.1` requires at least Gradle `9.3.1` (Flutter's minimum), +and AGP `9.3` requires at least Gradle `9.5.0`. +For other combinations, consult the [AGP and Gradle compatibility table][]. + +```properties diff title="/android/gradle/wrapper/gradle-wrapper.properties" +- distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip ++ distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip +``` + +Gradle 9 requires Java 17 or later. +If Flutter uses an older JDK, configure a newer JDK path with +`flutter config --jdk-dir=JDK_PATH`. + +### Update the Kotlin Gradle Plugin + +Skip this step if your project uses [built-in Kotlin][] +(`android.builtInKotlin=true`). +When `android.builtInKotlin=false` is set, the Flutter Gradle Plugin resolves +unpinned KGP declarations up to `2.4.10` and applies `kotlin-android` even if +your app has no Kotlin source files. +KGP versions resolved below `2.4.20` log a warning +(and KGP pinned below `2.4.10` fails the build). + +Update `org.jetbrains.kotlin.android` to `2.4.20` in your +`android/settings.gradle.kts` file: + +```kotlin diff title="/android/settings.gradle.kts" +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.3.1" apply false +- id("org.jetbrains.kotlin.android") version "2.4.0" apply false ++ id("org.jetbrains.kotlin.android") version "2.4.20" apply false +} +``` + +Projects created before Flutter 3.16 set `ext.kotlin_version` in +`android/build.gradle` instead. + +Applying KGP is deprecated with AGP 9. +Flutter logs a warning when your app or one of its plugins applies KGP, +and a future Flutter release will remove KGP support. +To migrate off KGP instead of continuing to update its version, follow the +[built-in Kotlin guide for app developers][]. + +### Test Flutter plugins + +Flutter plugins compile with the AGP, Gradle, and KGP versions configured by +the consuming app. +Test your plugin's example app with AGP `9.1.1` and `9.3.1`, +both with and without `android.builtInKotlin=false`. +For migration details, consult the +[built-in Kotlin guide for plugin authors][]. + +### Bypass the version check + +If you can't update your build tools immediately, pass +`--android-skip-build-dependency-validation` to `flutter run` or +`flutter build` to skip the version check. +Bypassing validation is unsupported: the Flutter Gradle Plugin calls AGP 9 +APIs that older versions don't provide, so your build can still fail. + +## Built-in Kotlin and the new AGP DSL + +AGP 9 enables [built-in Kotlin][] by default (rejecting the `kotlin-android` +plugin) and reads only the [new AGP DSL][]. +Flutter keeps existing projects building across those AGP 9 changes with two +Gradle properties in `android/gradle.properties`: + +- `flutter create` writes `android.builtInKotlin=false` and + `android.newDsl=false` to new projects. +- If either line is missing, Flutter's migrator appends that line (with a + marker comment) on the next `flutter run` or `flutter build`. + Builds started directly from Gradle or Android Studio don't run the migrator. + +These properties keep existing build scripts and plugins working without an +immediate built-in Kotlin or DSL migration. +When `android.builtInKotlin=false` is set, KGP below `2.4.20` logs a warning, +so update KGP to `2.4.20` or migrate to built-in Kotlin. + +When you're ready to adopt AGP 9's defaults: + +- To migrate to built-in Kotlin (`android.builtInKotlin=true`), follow + [Migrating Flutter Android projects to built-in Kotlin][built-in Kotlin]. +- To prepare custom build scripts for `android.newDsl=true`, consult + [Extend the Android Gradle Plugin][Variant API]. + Flutter 3.50 sets `android.newDsl=false` by default, so migrating your own + build scripts isn't required yet. + +## Timeline + +In stable release: 3.50 + +## References + +- [Android dependency versions support policy][support policy]: Policy defining + minimum, warning, and template default versions for Android build tools in + Flutter. +- [AGP and Gradle compatibility table][]: Official Android matrix for matching + AGP, Gradle, and JDK versions. +- [Migrating Flutter Android projects to built-in Kotlin][built-in Kotlin]: + Guide to removing the deprecated `kotlin-android` plugin on AGP 9 and later. + +[AGP and Gradle compatibility table]: {{site.android-dev}}/build/releases/about-agp#updating-gradle +[AGP roadmap]: {{site.android-dev}}/build/releases/gradle-plugin-roadmap +[built-in Kotlin]: /release/breaking-changes/migrate-to-built-in-kotlin +[built-in Kotlin guide for app developers]: /release/breaking-changes/migrate-to-built-in-kotlin/for-app-developers +[built-in Kotlin guide for plugin authors]: /release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors +[kotlin-and-dsl]: #built-in-kotlin-and-the-new-agp-dsl +[new AGP DSL]: {{site.android-dev}}/build/releases/agp-9-0-0-release-notes#android-gradle-plugin-changed-dsl +[support policy]: /go/android-dependency-versions +[Variant API]: {{site.android-dev}}/build/extend-agp diff --git a/sites/docs/src/content/release/breaking-changes/index.md b/sites/docs/src/content/release/breaking-changes/index.md index 7b86f95907..00fef6ae47 100644 --- a/sites/docs/src/content/release/breaking-changes/index.md +++ b/sites/docs/src/content/release/breaking-changes/index.md @@ -41,6 +41,7 @@ They're sorted by release and listed in alphabetical order: * [Added `enabled` to `DropdownButtonFormField` and made `onChanged` optional][] (`material_ui` 1.8.0) * [Migrate to standalone `material_ui` and `cupertino_ui` packages][] +* [Raised minimum Android build tool versions][] * [Restrict Android engine flags in release mode][] * [Soft hyphens render at line breaks][] * [Stricter Android `Intent` verification for app entrypoints][] @@ -49,6 +50,7 @@ They're sorted by release and listed in alphabetical order: [Added `enabled` to `DropdownButtonFormField` and made `onChanged` optional]: /release/breaking-changes/dropdownbuttonformfield-enabled-parameter [Migrate to standalone `material_ui` and `cupertino_ui` packages]: /release/breaking-changes/material-ui-and-cupertino-ui +[Raised minimum Android build tool versions]: /release/breaking-changes/android-build-tool-minimum-versions [Restrict Android engine flags in release mode]: /release/breaking-changes/restrict-android-engine-flags-release-mode [Soft hyphens render at line breaks]: /release/breaking-changes/soft-hyphen-rendering [Stricter Android `Intent` verification for app entrypoints]: /release/breaking-changes/stricter-android-entrypoint-intent-verification From fb0cf1530defd4a2924a3c40f2bd87457a1f6674 Mon Sep 17 00:00:00 2001 From: reidbaker-agent <269567208+reidbaker-agent@users.noreply.github.com> Date: Mon, 16 Nov 2026 19:14:55 -0500 Subject: [PATCH 2/9] Remove non-actionable SDK defaults, internal policy comparison, and suggestions note --- .../android-build-tool-minimum-versions.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index 056a8e5ea6..6de7bc0146 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -40,11 +40,6 @@ Flutter 3.50 doesn't support AGP 10 or later. Projects configured with AGP 10 fail validation until a future Flutter release adds AGP 10 support. -Default Android SDK and NDK values are unchanged from Flutter 3.47: -`compileSdk` is `36`, `targetSdk` is `36`, `minSdk` is `24`, -and the default NDK version is `28.2.13676358`. -Setting `minSdk` to `23` logs a warning, and `22` or lower fails the build. - :::warning Projects created with Flutter 3.44 or 3.47 need manual updates Unmodified projects created with Flutter 3.44 or Flutter 3.47 fail to build on Flutter 3.50 until you update their Gradle files. @@ -69,12 +64,6 @@ Update to the Flutter 3.50 template versions (`AGP 9.3.1`, `Gradle 9.5.0`, and Flutter checks your Gradle, Java, AGP, and KGP versions on every Android build and enforces a [support policy][] for these tools. -Under that policy, Flutter marks a version as "warn" for at least one stable -release before raising the minimum ("error") in a later release. -In Flutter 3.50, AGP `9.0.1` through `9.1.0`, Gradle `9.1.0` through `9.3.0`, -and KGP `2.3.20` through `2.4.9` fail validation without a prior warning in -Flutter 3.47. -Flutter 3.47 warned only below AGP `9.0.1`, Gradle `9.1.0`, and KGP `2.3.20`. Flutter 3.50 raises the minimum versions for two reasons: @@ -133,10 +122,6 @@ Check the build files and toolchain settings in your Flutter project: - **Java (JDK):** Run `flutter doctor -v` and check the Java version listed under the Android toolchain section. -Running `flutter analyze --suggestions` checks cross-tool compatibility between -Java, Gradle, AGP, and KGP (printing `compatible java/gradle/agp/kgp` when -valid), rather than Flutter's minimum thresholds. - ### Update the Android Gradle Plugin Update AGP to `9.3.1` (the default for Flutter 3.50 project templates) to avoid From 6572df9e53c25c5d7816d89b687d32081b0c3056 Mon Sep 17 00:00:00 2001 From: reidbaker-agent <269567208+reidbaker-agent@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:36:01 -0500 Subject: [PATCH 3/9] Tighten build-tool minimums triage, Before/After snippets, and AGP 10 wording --- .../android-build-tool-minimum-versions.md | 289 +++++++++++------- 1 file changed, 178 insertions(+), 111 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index 6de7bc0146..be024fd53a 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -10,11 +10,10 @@ description: >- ## Summary -To build a Flutter app, module, or plugin for Android, Flutter 3.50 requires -newer minimum versions of the Android build tools than Flutter 3.47 required. -Builds that resolve below these minimums—or configure Android Gradle Plugin -(AGP) 10 or later—fail with an error naming the dependency and required -version. +Flutter 3.50 requires newer minimum Android build tool versions than Flutter +3.47 for Android app, module, and plugin builds. +Builds below these minimums, or configured with Android Gradle Plugin (AGP) 10 +or later, fail validation with an error naming the required version. The following table compares the minimum, warning, and template default versions between Flutter 3.47 and Flutter 3.50: @@ -26,59 +25,59 @@ versions between Flutter 3.47 and Flutter 3.50: | Kotlin Gradle Plugin (KGP) | 2.2.20 | **2.4.10** | 2.4.20 | 2.4.20 | | Java (JDK) | 17 | 17 | 17 | — | -Flutter skips the KGP version check when your project uses AGP's -[built-in Kotlin][] (`android.builtInKotlin=true`). -With `android.builtInKotlin=false` -(refer to [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]), -the Flutter Gradle Plugin depends on KGP `2.4.10` and applies `kotlin-android` -when KGP is on the build classpath. -Gradle resolves lower unpinned KGP declarations up to `2.4.10`, -logging a `< 2.4.20` warning instead of failing the build -(even without Kotlin source files). - -Flutter 3.50 doesn't support AGP 10 or later. -Projects configured with AGP 10 fail validation until a future Flutter release -adds AGP 10 support. +Your build passes validation without edits if it uses AGP `9.1.1` through +`9.x`, Gradle `9.3.1` or later, and Java `17` or later. +If KGP is applied, don't pin it below `2.4.10`. +To clear deprecation warnings, update to AGP `9.3.1`, Gradle `9.5.0`, and +either [built-in Kotlin][] or KGP `2.4.20`. + +Two version rules apply alongside the minimums in the table: + +- **KGP check:** Flutter skips KGP validation when [built-in Kotlin][] + (`android.builtInKotlin=true`) is active. + With `android.builtInKotlin=false`, the Flutter Gradle Plugin depends on KGP + `2.4.10` and applies `kotlin-android` when KGP is on the classpath. + Gradle resolves lower unpinned KGP declarations up to `2.4.10`, logging a + `< 2.4.20` warning instead of failing (even without Kotlin source files). + For details, refer to + [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. +- **AGP 10 upper bound:** Flutter 3.50 doesn't support AGP 10 or later, + and projects configured with AGP 10 fail validation. :::warning Projects created with Flutter 3.44 or 3.47 need manual updates -Unmodified projects created with Flutter 3.44 or Flutter 3.47 fail to build on -Flutter 3.50 until you update their Gradle files. +Unmodified projects created with Flutter 3.44 or Flutter 3.47 fail validation +on Flutter 3.50 until you update their Gradle files. Neither `flutter upgrade` nor `flutter build` updates these tool versions: - **Flutter 3.44 templates** used Gradle `9.1.0` and AGP `9.0.1`. - Both are below the Flutter 3.50 minimums, so update Gradle to at least + Both fall below the Flutter 3.50 minimums, so update Gradle to at least `9.3.1` and AGP to at least `9.1.1`. -- **Flutter 3.47 templates** used AGP `9.1.0`, which is below the minimum, +- **Flutter 3.47 templates** used AGP `9.1.0`, which falls below the minimum, so update AGP to at least `9.1.1`. Their Gradle version (`9.3.1`) meets the minimum and logs a warning. Both templates also declared an older KGP (`2.3.20` in 3.44, `2.4.0` in 3.47). -Flutter 3.50's Gradle plugin resolves KGP up to `2.4.10`, -so the build logs a warning rather than failing on KGP until you declare KGP -`2.4.20` or later. -Update to the Flutter 3.50 template versions (`AGP 9.3.1`, `Gradle 9.5.0`, and -`KGP 2.4.20`) in the [migration guide](#migration-guide) to clear all warnings. +Flutter 3.50 resolves unpinned KGP up to `2.4.10`, so the build logs a warning +rather than failing until you declare KGP `2.4.20` or later. +Follow the [migration guide](#migration-guide) to update to `AGP 9.3.1`, +`Gradle 9.5.0`, and `KGP 2.4.20` and clear all warnings. ::: ## Background Flutter checks your Gradle, Java, AGP, and KGP versions on every Android build and enforces a [support policy][] for these tools. - Flutter 3.50 raises the minimum versions for two reasons: -- Requiring AGP 9 means every project builds with AGP 9's API surface. - The Flutter Gradle Plugin uses public AGP 9 APIs instead of maintaining - separate code paths for AGP 8 and AGP 9. +- Requiring AGP 9 gives every build AGP 9's public APIs, so the Flutter Gradle + Plugin doesn't maintain separate AGP 8 and AGP 9 code paths. - AGP `9.1.1` and later support `compileSdk` 37 (Android 17), - preparing Flutter to target Android 17 in a future release without another - minimum version bump. + preparing Flutter to target Android 17 without another minimum version bump. -According to the [AGP roadmap][], AGP 10 removes the legacy DSL, -the legacy variant APIs, and the `android.newDsl=false` opt-out that Flutter -sets for projects. +The [AGP migration timeline][] schedules the removal of the legacy DSL, +the legacy variant APIs, and the `android.newDsl=false` opt-out for AGP 10. Because Flutter hasn't been validated against AGP 10, -Flutter 3.50 rejects AGP 10 builds cleanly before Gradle configuration fails: +Flutter 3.50 rejects AGP 10 builds before Gradle configuration fails: ```plaintext noHighlight Error: Your project's Android Gradle Plugin version (10.0.0) is not yet @@ -103,104 +102,149 @@ to bypass this check. ## Migration guide -No changes are required to pass validation when your project uses AGP `9.1.1` -through `9.x`, Gradle `9.3.1` or later, and Java `17` or later -(without pinning KGP below `2.4.10`). -To clear deprecation warnings, use AGP `9.3.1` or later, Gradle `9.5.0` or -later, and either [built-in Kotlin][] or KGP `2.4.20` or later. - ### Check your versions -Check the build files and toolchain settings in your Flutter project: - -- **AGP and KGP:** Inspect the `plugins {}` block in your - `android/settings.gradle.kts` (or `android/settings.gradle`) file. - Projects created before Flutter 3.16 declare these versions in the - `buildscript` block of `android/build.gradle`. -- **Gradle:** Inspect the `distributionUrl` line in your - `android/gradle/wrapper/gradle-wrapper.properties` file. +Inspect the build files and toolchain settings in your Flutter project to check +which tools need updates: + +- **AGP and KGP:** Check the `plugins {}` block in + `android/settings.gradle.kts` (or `android/settings.gradle`), + or `buildscript` in `android/build.gradle` on projects created before + Flutter 3.16. + Refer to [Update the Android Gradle Plugin][update-agp] and + [Update the Kotlin Gradle Plugin][update-kgp]. +- **Gradle:** Check `distributionUrl` in + `android/gradle/wrapper/gradle-wrapper.properties`. + Refer to [Update Gradle][update-gradle]. - **Java (JDK):** Run `flutter doctor -v` and check the Java version listed under the Android toolchain section. ### Update the Android Gradle Plugin -Update AGP to `9.3.1` (the default for Flutter 3.50 project templates) to avoid -the deprecation warning, or to at least `9.1.1`. +Before updating AGP, check two compatibility requirements: + +- AGP `9.3.1` requires Gradle `9.5.0` or later + (refer to [Update Gradle][update-gradle]), + while AGP `9.1.1` works with Gradle `9.3.1` or later. +- If you're upgrading from AGP 8, also review + [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. + +Update AGP to `9.3.1` (the Flutter 3.50 template default) to clear warnings, +or to at least `9.1.1`. +On projects created with Flutter 3.16 or later, edit `plugins {}` in +`android/settings.gradle.kts` (or `android/settings.gradle`). -Projects created with Flutter 3.16 or later declare AGP in the `plugins {}` -block of `android/settings.gradle.kts` (or `android/settings.gradle`): +Code before migration: -```kotlin diff title="/android/settings.gradle.kts" +```kotlin title="/android/settings.gradle.kts" plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" -- id("com.android.application") version "9.1.0" apply false -+ id("com.android.application") version "9.3.1" apply false + id("com.android.application") version "9.1.0" apply false id("org.jetbrains.kotlin.android") version "2.4.0" apply false } ``` -Projects created before Flutter 3.16 declare AGP as a `classpath` dependency -in `android/build.gradle`: +Code after migration: -```groovy diff title="/android/build.gradle" +```kotlin title="/android/settings.gradle.kts" +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + // Minimum in 3.50 is 9.1.1; 9.3.1 clears warnings (requires Gradle 9.5.0+). + id("com.android.application") version "9.3.1" apply false + id("org.jetbrains.kotlin.android") version "2.4.0" apply false +} +``` + +On projects created before Flutter 3.16, update the `classpath` dependency in +`android/build.gradle` instead. + +Code before migration: + +```groovy title="/android/build.gradle" buildscript { dependencies { -- classpath 'com.android.tools.build:gradle:8.11.1' -+ classpath 'com.android.tools.build:gradle:9.3.1' + classpath 'com.android.tools.build:gradle:8.11.1' } } ``` -If you're upgrading from AGP 8, also refer to -[Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. +Code after migration: + +```groovy title="/android/build.gradle" +buildscript { + dependencies { + // Minimum in 3.50 is 9.1.1; 9.3.1 clears warnings (requires Gradle 9.5.0+). + classpath 'com.android.tools.build:gradle:9.3.1' + } +} +``` ### Update Gradle -Update the Gradle wrapper in your -`android/gradle/wrapper/gradle-wrapper.properties` file. -Flutter recommends Gradle `9.5.0`. -Each AGP version requires a minimum Gradle version: -AGP `9.1` requires at least Gradle `9.3.1` (Flutter's minimum), -and AGP `9.3` requires at least Gradle `9.5.0`. -For other combinations, consult the [AGP and Gradle compatibility table][]. - -```properties diff title="/android/gradle/wrapper/gradle-wrapper.properties" -- distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip -+ distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip +Before updating the Gradle wrapper, check your Java and AGP versions: + +- Gradle 9 requires Java 17 or later. + If Flutter uses an older JDK, configure a Java 17 or newer path with + `flutter config --jdk-dir=`. +- Each AGP version requires a minimum Gradle version: + AGP `9.1` requires at least Gradle `9.3.1` (Flutter's minimum), + and AGP `9.3` requires at least Gradle `9.5.0`. + For other combinations, consult the [AGP and Gradle compatibility table][]. + +Update `distributionUrl` in `android/gradle/wrapper/gradle-wrapper.properties` +to Gradle `9.5.0` (or at least `9.3.1` with AGP `9.1.1`). + +Code before migration: + +```properties title="/android/gradle/wrapper/gradle-wrapper.properties" +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip ``` -Gradle 9 requires Java 17 or later. -If Flutter uses an older JDK, configure a newer JDK path with -`flutter config --jdk-dir=JDK_PATH`. +Code after migration: + +```properties title="/android/gradle/wrapper/gradle-wrapper.properties" +# Minimum in 3.50 is 9.3.1; AGP 9.3.1 requires Gradle 9.5.0 or later. +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip +``` ### Update the Kotlin Gradle Plugin Skip this step if your project uses [built-in Kotlin][] (`android.builtInKotlin=true`). When `android.builtInKotlin=false` is set, the Flutter Gradle Plugin resolves -unpinned KGP declarations up to `2.4.10` and applies `kotlin-android` even if -your app has no Kotlin source files. -KGP versions resolved below `2.4.20` log a warning -(and KGP pinned below `2.4.10` fails the build). +unpinned KGP declarations up to `2.4.10` and applies `kotlin-android` even +without Kotlin source files. +Resolved KGP versions below `2.4.20` log a warning, +and KGP pinned below `2.4.10` fails the build. + +Update `org.jetbrains.kotlin.android` to `2.4.20` in +`android/settings.gradle.kts` +(projects created before Flutter 3.16 set `ext.kotlin_version` in +`android/build.gradle` instead). -Update `org.jetbrains.kotlin.android` to `2.4.20` in your -`android/settings.gradle.kts` file: +Code before migration: -```kotlin diff title="/android/settings.gradle.kts" +```kotlin title="/android/settings.gradle.kts" plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" id("com.android.application") version "9.3.1" apply false -- id("org.jetbrains.kotlin.android") version "2.4.0" apply false -+ id("org.jetbrains.kotlin.android") version "2.4.20" apply false + id("org.jetbrains.kotlin.android") version "2.4.0" apply false } ``` -Projects created before Flutter 3.16 set `ext.kotlin_version` in -`android/build.gradle` instead. +Code after migration: -Applying KGP is deprecated with AGP 9. -Flutter logs a warning when your app or one of its plugins applies KGP, -and a future Flutter release will remove KGP support. +```kotlin title="/android/settings.gradle.kts" +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.3.1" apply false + // Minimum when KGP is applied is 2.4.10; 2.4.20 clears warnings. + id("org.jetbrains.kotlin.android") version "2.4.20" apply false +} +``` + +Applying KGP is deprecated on AGP 9, and Flutter logs a warning when your app +or a plugin applies it ([Issue 184837][]). To migrate off KGP instead of continuing to update its version, follow the [built-in Kotlin guide for app developers][]. @@ -208,36 +252,53 @@ To migrate off KGP instead of continuing to update its version, follow the Flutter plugins compile with the AGP, Gradle, and KGP versions configured by the consuming app. -Test your plugin's example app with AGP `9.1.1` and `9.3.1`, -both with and without `android.builtInKotlin=false`. -For migration details, consult the +Test your plugin's example app on both AGP `9.1.1` (with Gradle `9.3.1`) and +AGP `9.3.1` (with Gradle `9.5.0`), with `android.builtInKotlin=false` and +`android.builtInKotlin=true`. +For plugin migration details, consult the [built-in Kotlin guide for plugin authors][]. ### Bypass the version check +:::caution Unsupported flag +Bypassing dependency validation is unsupported. +The Flutter Gradle Plugin calls AGP 9 APIs that older versions don't provide, +so your build can still fail. +::: + If you can't update your build tools immediately, pass `--android-skip-build-dependency-validation` to `flutter run` or -`flutter build` to skip the version check. -Bypassing validation is unsupported: the Flutter Gradle Plugin calls AGP 9 -APIs that older versions don't provide, so your build can still fail. +`flutter build`: + +```bash +flutter build apk --android-skip-build-dependency-validation +``` ## Built-in Kotlin and the new AGP DSL AGP 9 enables [built-in Kotlin][] by default (rejecting the `kotlin-android` -plugin) and reads only the [new AGP DSL][]. -Flutter keeps existing projects building across those AGP 9 changes with two -Gradle properties in `android/gradle.properties`: +plugin) and exposes only the [new AGP DSL][]. +Flutter keeps existing build scripts and plugins working across those AGP 9 +defaults with two Gradle properties in `android/gradle.properties`: - `flutter create` writes `android.builtInKotlin=false` and `android.newDsl=false` to new projects. -- If either line is missing, Flutter's migrator appends that line (with a - marker comment) on the next `flutter run` or `flutter build`. - Builds started directly from Gradle or Android Studio don't run the migrator. +- When either property is missing, `flutter run` or `flutter build` appends it + with a marker comment. + Builds started directly from Gradle or Android Studio don't run that + migrator. + +If you build directly from Gradle or Android Studio, confirm that +`android/gradle.properties` sets both properties: + +```properties title="/android/gradle.properties" +# Keep legacy KGP and DSL compatibility until your app and plugins migrate. +android.builtInKotlin=false +android.newDsl=false +``` -These properties keep existing build scripts and plugins working without an -immediate built-in Kotlin or DSL migration. -When `android.builtInKotlin=false` is set, KGP below `2.4.20` logs a warning, -so update KGP to `2.4.20` or migrate to built-in Kotlin. +When `android.builtInKotlin=false` is set, KGP resolved below `2.4.20` logs a +warning, so update KGP to `2.4.20` or migrate to built-in Kotlin. When you're ready to adopt AGP 9's defaults: @@ -259,15 +320,21 @@ In stable release: 3.50 Flutter. - [AGP and Gradle compatibility table][]: Official Android matrix for matching AGP, Gradle, and JDK versions. +- [AGP DSL and API migration timeline][AGP migration timeline]: Official + Android schedule for legacy DSL and Variant API removals. - [Migrating Flutter Android projects to built-in Kotlin][built-in Kotlin]: Guide to removing the deprecated `kotlin-android` plugin on AGP 9 and later. [AGP and Gradle compatibility table]: {{site.android-dev}}/build/releases/about-agp#updating-gradle -[AGP roadmap]: {{site.android-dev}}/build/releases/gradle-plugin-roadmap +[AGP migration timeline]: {{site.android-dev}}/build/releases/gradle-plugin-roadmap#agp-10 [built-in Kotlin]: /release/breaking-changes/migrate-to-built-in-kotlin [built-in Kotlin guide for app developers]: /release/breaking-changes/migrate-to-built-in-kotlin/for-app-developers [built-in Kotlin guide for plugin authors]: /release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors +[Issue 184837]: {{site.repo.flutter}}/issues/184837 [kotlin-and-dsl]: #built-in-kotlin-and-the-new-agp-dsl -[new AGP DSL]: {{site.android-dev}}/build/releases/agp-9-0-0-release-notes#android-gradle-plugin-changed-dsl +[new AGP DSL]: {{site.android-dev}}/build/releases/agp-9-0-0-release-notes#android-gradle-plugin-new-dsl [support policy]: /go/android-dependency-versions +[update-agp]: #update-the-android-gradle-plugin +[update-gradle]: #update-gradle +[update-kgp]: #update-the-kotlin-gradle-plugin [Variant API]: {{site.android-dev}}/build/extend-agp From c5187cf3e9d00335d2c4993cc3b1e8ea75964556 Mon Sep 17 00:00:00 2001 From: reidbaker-agent <269567208+reidbaker-agent@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:48:27 -0500 Subject: [PATCH 4/9] Add project triage table, pre-3.16 KGP snippet, and style fixes --- .../android-build-tool-minimum-versions.md | 221 ++++++++++-------- 1 file changed, 124 insertions(+), 97 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index be024fd53a..df48a1c315 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -10,74 +10,71 @@ description: >- ## Summary -Flutter 3.50 requires newer minimum Android build tool versions than Flutter -3.47 for Android app, module, and plugin builds. -Builds below these minimums, or configured with Android Gradle Plugin (AGP) 10 -or later, fail validation with an error naming the required version. +Flutter 3.50 raises the minimum versions for Android build tools compared to +Flutter 3.47. +Builds configured below these minimums, or with Android Gradle Plugin (AGP) 10 +or later, fail dependency validation. The following table compares the minimum, warning, and template default versions between Flutter 3.47 and Flutter 3.50: -| Dependency | Flutter 3.47 minimum | Flutter 3.50 minimum | Warns below (3.50) | New project default (3.50) | +| Dependency | Flutter 3.47 minimum | Flutter 3.50 minimum | Warns below (3.50) | Template default (3.50) | | :--- | :--- | :--- | :--- | :--- | | Android Gradle Plugin (AGP) | 8.11.1 | **9.1.1** | 9.3.1 | 9.3.1 | | Gradle | 8.14.0 | **9.3.1** | 9.5.0 | 9.5.0 | -| Kotlin Gradle Plugin (KGP) | 2.2.20 | **2.4.10** | 2.4.20 | 2.4.20 | +| Kotlin Gradle Plugin (KGP, when applied) | 2.2.20 | **2.4.10** | 2.4.20 | 2.4.20 | | Java (JDK) | 17 | 17 | 17 | — | -Your build passes validation without edits if it uses AGP `9.1.1` through -`9.x`, Gradle `9.3.1` or later, and Java `17` or later. -If KGP is applied, don't pin it below `2.4.10`. -To clear deprecation warnings, update to AGP `9.3.1`, Gradle `9.5.0`, and -either [built-in Kotlin][] or KGP `2.4.20`. - Two version rules apply alongside the minimums in the table: -- **KGP check:** Flutter skips KGP validation when [built-in Kotlin][] +- **KGP validation:** Flutter skips the KGP check when [built-in Kotlin][] (`android.builtInKotlin=true`) is active. - With `android.builtInKotlin=false`, the Flutter Gradle Plugin depends on KGP - `2.4.10` and applies `kotlin-android` when KGP is on the classpath. - Gradle resolves lower unpinned KGP declarations up to `2.4.10`, logging a - `< 2.4.20` warning instead of failing (even without Kotlin source files). - For details, refer to - [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. + With `android.builtInKotlin=false`, the Flutter Gradle Plugin (FGP) depends + on KGP `2.4.10`. + FGP applies `kotlin-android` whenever KGP is on the classpath, even without + Kotlin source files. + In `settings.gradle(.kts)`, Gradle resolves unpinned KGP versions up to + `2.4.10` and logs a warning. + Pinning KGP below `2.4.10`, or setting `ext.kotlin_version` below `2.4.10`, + fails validation. + For details, refer to [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. - **AGP 10 upper bound:** Flutter 3.50 doesn't support AGP 10 or later, - and projects configured with AGP 10 fail validation. - -:::warning Projects created with Flutter 3.44 or 3.47 need manual updates -Unmodified projects created with Flutter 3.44 or Flutter 3.47 fail validation -on Flutter 3.50 until you update their Gradle files. -Neither `flutter upgrade` nor `flutter build` updates these tool versions: - -- **Flutter 3.44 templates** used Gradle `9.1.0` and AGP `9.0.1`. - Both fall below the Flutter 3.50 minimums, so update Gradle to at least - `9.3.1` and AGP to at least `9.1.1`. -- **Flutter 3.47 templates** used AGP `9.1.0`, which falls below the minimum, - so update AGP to at least `9.1.1`. - Their Gradle version (`9.3.1`) meets the minimum and logs a warning. - -Both templates also declared an older KGP (`2.3.20` in 3.44, `2.4.0` in 3.47). -Flutter 3.50 resolves unpinned KGP up to `2.4.10`, so the build logs a warning -rather than failing until you declare KGP `2.4.20` or later. -Follow the [migration guide](#migration-guide) to update to `AGP 9.3.1`, -`Gradle 9.5.0`, and `KGP 2.4.20` and clear all warnings. + and builds configured with AGP 10 fail validation. + +:::important Projects from Flutter 3.44 or 3.47 need manual updates +Neither `flutter upgrade` nor `flutter build` updates tool versions in an +app's `android/` directory. +Unmodified apps created with Flutter 3.44 or Flutter 3.47 use AGP versions +below `9.1.1` and fail validation until updated. ::: +Use the following table to check how Flutter 3.50 affects your project: + +| Project configuration | Behavior on Flutter 3.50 | Action | +| :--- | :--- | :--- | +| AGP `9.1.1` through `9.x`, Gradle `9.3.1+`, Java 17+, and built-in Kotlin (or KGP `2.4.10+`) | Passes validation; warns below AGP `9.3.1`, Gradle `9.5.0`, or KGP `2.4.20` | Optional: update to `9.3.1`, `9.5.0`, and [built-in Kotlin][] (or KGP `2.4.20`) to clear warnings | +| Unmodified Flutter 3.47 app (AGP `9.1.0`, Gradle `9.3.1`, KGP `2.4.0`) | Fails on AGP; warns on Gradle and KGP (resolved to `2.4.10`) | [Update AGP][update-agp], [Gradle][update-gradle], and [KGP][update-kgp] | +| Unmodified Flutter 3.44 app (AGP `9.0.1`, Gradle `9.1.0`, KGP `2.3.20`) | Fails on Gradle and AGP; warns on KGP (resolved to `2.4.10`) | [Update AGP][update-agp], [Gradle][update-gradle], and [KGP][update-kgp] | +| Pre-3.16 `buildscript` app (`classpath` and `ext.kotlin_version`) | Fails on any tool version below the 3.50 minimum | Update `android/build.gradle` and `gradle-wrapper.properties` ([Check your versions][check-versions]) | +| Flutter module or add-to-app project | `flutter pub get` updates standalone `.android/`; host Android apps validate host versions | Update the host Android project's Gradle, AGP, and KGP versions ([Check your versions][check-versions]) | +| Android plugin | Consuming app sets tool versions; plugin's `example/` app runs validation | [Test Flutter plugins][test-plugins] on AGP `9.1.1` and `9.3.1` | + ## Background Flutter checks your Gradle, Java, AGP, and KGP versions on every Android build and enforces a [support policy][] for these tools. Flutter 3.50 raises the minimum versions for two reasons: -- Requiring AGP 9 gives every build AGP 9's public APIs, so the Flutter Gradle - Plugin doesn't maintain separate AGP 8 and AGP 9 code paths. +- Requiring AGP 9 provides the public AGP 9 APIs on every build, so FGP + doesn't maintain separate AGP 8 and AGP 9 code paths. - AGP `9.1.1` and later support `compileSdk` 37 (Android 17), - preparing Flutter to target Android 17 without another minimum version bump. + preparing Flutter to target Android 17 without raising the minimum version + again. The [AGP migration timeline][] schedules the removal of the legacy DSL, the legacy variant APIs, and the `android.newDsl=false` opt-out for AGP 10. -Because Flutter hasn't been validated against AGP 10, -Flutter 3.50 rejects AGP 10 builds before Gradle configuration fails: +Because Flutter hasn't validated AGP 10, +Flutter 3.50 rejects AGP 10 or later during dependency validation: ```plaintext noHighlight Error: Your project's Android Gradle Plugin version (10.0.0) is not yet @@ -104,35 +101,38 @@ to bypass this check. ### Check your versions -Inspect the build files and toolchain settings in your Flutter project to check -which tools need updates: +Inspect the build files and toolchain settings in your Flutter app +(or in the host Android project for add-to-app builds): -- **AGP and KGP:** Check the `plugins {}` block in - `android/settings.gradle.kts` (or `android/settings.gradle`), - or `buildscript` in `android/build.gradle` on projects created before - Flutter 3.16. +- **AGP and KGP:** Check `plugins {}` in `android/settings.gradle.kts` + (or `android/settings.gradle`), or check `gradle/libs.versions.toml`. + On projects created before Flutter 3.16, check the `buildscript` block in + `android/build.gradle`. Refer to [Update the Android Gradle Plugin][update-agp] and [Update the Kotlin Gradle Plugin][update-kgp]. -- **Gradle:** Check `distributionUrl` in +- **Gradle:** Check the `distributionUrl` property in `android/gradle/wrapper/gradle-wrapper.properties`. Refer to [Update Gradle][update-gradle]. -- **Java (JDK):** Run `flutter doctor -v` and check the Java version listed - under the Android toolchain section. +- **Java (JDK):** Run `flutter doctor -v` and check the `Java version` line + under **Android toolchain**. + +For a standalone Flutter module, running `flutter pub get` regenerates the +ephemeral `.android/` directory with the Flutter 3.50 defaults. ### Update the Android Gradle Plugin Before updating AGP, check two compatibility requirements: - AGP `9.3.1` requires Gradle `9.5.0` or later - (refer to [Update Gradle][update-gradle]), - while AGP `9.1.1` works with Gradle `9.3.1` or later. + (refer to [Update Gradle][update-gradle]). + AGP `9.1.1` works with Gradle `9.3.1` or later. - If you're upgrading from AGP 8, also review [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. Update AGP to `9.3.1` (the Flutter 3.50 template default) to clear warnings, or to at least `9.1.1`. -On projects created with Flutter 3.16 or later, edit `plugins {}` in -`android/settings.gradle.kts` (or `android/settings.gradle`). +On projects created with Flutter 3.16 or later, update the `plugins {}` block +in `android/settings.gradle.kts` (or `android/settings.gradle`). Code before migration: @@ -140,7 +140,7 @@ Code before migration: plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" id("com.android.application") version "9.1.0" apply false - id("org.jetbrains.kotlin.android") version "2.4.0" apply false + // ... } ``` @@ -151,7 +151,7 @@ plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" // Minimum in 3.50 is 9.1.1; 9.3.1 clears warnings (requires Gradle 9.5.0+). id("com.android.application") version "9.3.1" apply false - id("org.jetbrains.kotlin.android") version "2.4.0" apply false + // ... } ``` @@ -184,15 +184,15 @@ buildscript { Before updating the Gradle wrapper, check your Java and AGP versions: - Gradle 9 requires Java 17 or later. - If Flutter uses an older JDK, configure a Java 17 or newer path with - `flutter config --jdk-dir=`. -- Each AGP version requires a minimum Gradle version: - AGP `9.1` requires at least Gradle `9.3.1` (Flutter's minimum), + If Flutter uses an older JDK, run `flutter config --jdk-dir=JDK_DIR`, + replacing `JDK_DIR` with your Java 17 or later path. +- Each AGP release requires a minimum Gradle version. + AGP `9.1` requires at least Gradle `9.3.1`, and AGP `9.3` requires at least Gradle `9.5.0`. For other combinations, consult the [AGP and Gradle compatibility table][]. -Update `distributionUrl` in `android/gradle/wrapper/gradle-wrapper.properties` -to Gradle `9.5.0` (or at least `9.3.1` with AGP `9.1.1`). +Set `distributionUrl` in `android/gradle/wrapper/gradle-wrapper.properties` +to Gradle `9.5.0` (or `9.3.1` with AGP `9.1.1`). Code before migration: @@ -211,23 +211,18 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip Skip this step if your project uses [built-in Kotlin][] (`android.builtInKotlin=true`). -When `android.builtInKotlin=false` is set, the Flutter Gradle Plugin resolves -unpinned KGP declarations up to `2.4.10` and applies `kotlin-android` even -without Kotlin source files. -Resolved KGP versions below `2.4.20` log a warning, -and KGP pinned below `2.4.10` fails the build. +With `android.builtInKotlin=false`, update KGP to `2.4.20` to clear warnings, +or to at least `2.4.10`. -Update `org.jetbrains.kotlin.android` to `2.4.20` in -`android/settings.gradle.kts` -(projects created before Flutter 3.16 set `ext.kotlin_version` in -`android/build.gradle` instead). +On projects created with Flutter 3.16 or later, update +`org.jetbrains.kotlin.android` in `android/settings.gradle.kts` +(or `android/settings.gradle`). Code before migration: ```kotlin title="/android/settings.gradle.kts" plugins { - id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "9.3.1" apply false + // ... id("org.jetbrains.kotlin.android") version "2.4.0" apply false } ``` @@ -236,39 +231,66 @@ Code after migration: ```kotlin title="/android/settings.gradle.kts" plugins { - id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "9.3.1" apply false - // Minimum when KGP is applied is 2.4.10; 2.4.20 clears warnings. + // ... + // Minimum when applied is 2.4.10; 2.4.20 clears warnings. id("org.jetbrains.kotlin.android") version "2.4.20" apply false } ``` +On projects created before Flutter 3.16, update `ext.kotlin_version` in +`android/build.gradle` instead. +Unlike unpinned `plugins {}` declarations, FGP checks `ext.kotlin_version` +directly and fails validation below `2.4.10`. + +Code before migration: + +```groovy title="/android/build.gradle" +buildscript { + ext.kotlin_version = '2.2.20' + // ... +} +``` + +Code after migration: + +```groovy title="/android/build.gradle" +buildscript { + // Minimum when applied is 2.4.10; 2.4.20 clears warnings. + ext.kotlin_version = '2.4.20' + // ... +} +``` + Applying KGP is deprecated on AGP 9, and Flutter logs a warning when your app or a plugin applies it ([Issue 184837][]). -To migrate off KGP instead of continuing to update its version, follow the +To migrate off KGP instead of updating its version, follow the [built-in Kotlin guide for app developers][]. ### Test Flutter plugins Flutter plugins compile with the AGP, Gradle, and KGP versions configured by the consuming app. -Test your plugin's example app on both AGP `9.1.1` (with Gradle `9.3.1`) and -AGP `9.3.1` (with Gradle `9.5.0`), with `android.builtInKotlin=false` and -`android.builtInKotlin=true`. -For plugin migration details, consult the +Verify your plugin's `example/` app against both supported configurations: + +- Minimum supported toolchain: AGP `9.1.1` with Gradle `9.3.1`. +- Template default toolchain: AGP `9.3.1` with Gradle `9.5.0`. + +Test each configuration with `android.builtInKotlin=false` and +`android.builtInKotlin=true` in `example/android/gradle.properties`. +For plugin migration steps, consult the [built-in Kotlin guide for plugin authors][]. ### Bypass the version check :::caution Unsupported flag Bypassing dependency validation is unsupported. -The Flutter Gradle Plugin calls AGP 9 APIs that older versions don't provide, +FGP calls AGP 9 APIs that older versions don't provide, so your build can still fail. ::: If you can't update your build tools immediately, pass -`--android-skip-build-dependency-validation` to `flutter run` or -`flutter build`: +`--android-skip-build-dependency-validation` to `flutter run`, +`flutter build apk`, or `flutter build appbundle`: ```bash flutter build apk --android-skip-build-dependency-validation @@ -278,18 +300,18 @@ flutter build apk --android-skip-build-dependency-validation AGP 9 enables [built-in Kotlin][] by default (rejecting the `kotlin-android` plugin) and exposes only the [new AGP DSL][]. -Flutter keeps existing build scripts and plugins working across those AGP 9 +Flutter keeps existing build scripts and plugins compatible across those defaults with two Gradle properties in `android/gradle.properties`: - `flutter create` writes `android.builtInKotlin=false` and `android.newDsl=false` to new projects. - When either property is missing, `flutter run` or `flutter build` appends it with a marker comment. - Builds started directly from Gradle or Android Studio don't run that - migrator. + Builds started directly from Gradle or Android Studio (including add-to-app + host builds) don't run that migrator. -If you build directly from Gradle or Android Studio, confirm that -`android/gradle.properties` sets both properties: +If you build directly from Gradle or Android Studio, confirm that your +project's `gradle.properties` file sets both properties: ```properties title="/android/gradle.properties" # Keep legacy KGP and DSL compatibility until your app and plugins migrate. @@ -297,17 +319,15 @@ android.builtInKotlin=false android.newDsl=false ``` -When `android.builtInKotlin=false` is set, KGP resolved below `2.4.20` logs a -warning, so update KGP to `2.4.20` or migrate to built-in Kotlin. - -When you're ready to adopt AGP 9's defaults: +Use the following guides when you're ready to adopt the AGP 9 defaults: - To migrate to built-in Kotlin (`android.builtInKotlin=true`), follow [Migrating Flutter Android projects to built-in Kotlin][built-in Kotlin]. - To prepare custom build scripts for `android.newDsl=true`, consult [Extend the Android Gradle Plugin][Variant API]. - Flutter 3.50 sets `android.newDsl=false` by default, so migrating your own - build scripts isn't required yet. + Flutter 3.50 defaults to `android.newDsl=false`, keeping legacy AGP + `android {}` types available until you enable `android.newDsl=true` + ([Issue 180137][]). ## Timeline @@ -324,16 +344,23 @@ In stable release: 3.50 Android schedule for legacy DSL and Variant API removals. - [Migrating Flutter Android projects to built-in Kotlin][built-in Kotlin]: Guide to removing the deprecated `kotlin-android` plugin on AGP 9 and later. +- [Issue 180137][]: Tracking issue for enabling `android.newDsl=true` by + default in Flutter project templates. +- [Issue 184837][]: Tracking issue for removing legacy Kotlin Gradle Plugin + support in a future Flutter release. [AGP and Gradle compatibility table]: {{site.android-dev}}/build/releases/about-agp#updating-gradle [AGP migration timeline]: {{site.android-dev}}/build/releases/gradle-plugin-roadmap#agp-10 [built-in Kotlin]: /release/breaking-changes/migrate-to-built-in-kotlin [built-in Kotlin guide for app developers]: /release/breaking-changes/migrate-to-built-in-kotlin/for-app-developers [built-in Kotlin guide for plugin authors]: /release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors +[check-versions]: #check-your-versions +[Issue 180137]: {{site.repo.flutter}}/issues/180137 [Issue 184837]: {{site.repo.flutter}}/issues/184837 [kotlin-and-dsl]: #built-in-kotlin-and-the-new-agp-dsl [new AGP DSL]: {{site.android-dev}}/build/releases/agp-9-0-0-release-notes#android-gradle-plugin-new-dsl [support policy]: /go/android-dependency-versions +[test-plugins]: #test-flutter-plugins [update-agp]: #update-the-android-gradle-plugin [update-gradle]: #update-gradle [update-kgp]: #update-the-kotlin-gradle-plugin From 9e31c5d87128e9dec9c4cab2c19a222a2cbc0866 Mon Sep 17 00:00:00 2001 From: reidbaker-agent <269567208+reidbaker-agent@users.noreply.github.com> Date: Tue, 17 Nov 2026 15:33:12 -0500 Subject: [PATCH 5/9] Replace summary triage table with bulleted list, drop pre-3.16 snippets, and clarify KGP resolution --- .../android-build-tool-minimum-versions.md | 95 +++++-------------- 1 file changed, 25 insertions(+), 70 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index df48a1c315..545bb3d022 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -33,10 +33,10 @@ Two version rules apply alongside the minimums in the table: on KGP `2.4.10`. FGP applies `kotlin-android` whenever KGP is on the classpath, even without Kotlin source files. - In `settings.gradle(.kts)`, Gradle resolves unpinned KGP versions up to - `2.4.10` and logs a warning. - Pinning KGP below `2.4.10`, or setting `ext.kotlin_version` below `2.4.10`, - fails validation. + Gradle dependency resolution upgrades lower KGP versions in + `settings.gradle(.kts)` `plugins {}` (such as `2.4.0`) to `2.4.10`, + and Flutter logs a warning. + Only a strict KGP version constraint below `2.4.10` fails validation. For details, refer to [Built-in Kotlin and the new AGP DSL][kotlin-and-dsl]. - **AGP 10 upper bound:** Flutter 3.50 doesn't support AGP 10 or later, and builds configured with AGP 10 fail validation. @@ -48,16 +48,23 @@ Unmodified apps created with Flutter 3.44 or Flutter 3.47 use AGP versions below `9.1.1` and fail validation until updated. ::: -Use the following table to check how Flutter 3.50 affects your project: - -| Project configuration | Behavior on Flutter 3.50 | Action | -| :--- | :--- | :--- | -| AGP `9.1.1` through `9.x`, Gradle `9.3.1+`, Java 17+, and built-in Kotlin (or KGP `2.4.10+`) | Passes validation; warns below AGP `9.3.1`, Gradle `9.5.0`, or KGP `2.4.20` | Optional: update to `9.3.1`, `9.5.0`, and [built-in Kotlin][] (or KGP `2.4.20`) to clear warnings | -| Unmodified Flutter 3.47 app (AGP `9.1.0`, Gradle `9.3.1`, KGP `2.4.0`) | Fails on AGP; warns on Gradle and KGP (resolved to `2.4.10`) | [Update AGP][update-agp], [Gradle][update-gradle], and [KGP][update-kgp] | -| Unmodified Flutter 3.44 app (AGP `9.0.1`, Gradle `9.1.0`, KGP `2.3.20`) | Fails on Gradle and AGP; warns on KGP (resolved to `2.4.10`) | [Update AGP][update-agp], [Gradle][update-gradle], and [KGP][update-kgp] | -| Pre-3.16 `buildscript` app (`classpath` and `ext.kotlin_version`) | Fails on any tool version below the 3.50 minimum | Update `android/build.gradle` and `gradle-wrapper.properties` ([Check your versions][check-versions]) | -| Flutter module or add-to-app project | `flutter pub get` updates standalone `.android/`; host Android apps validate host versions | Update the host Android project's Gradle, AGP, and KGP versions ([Check your versions][check-versions]) | -| Android plugin | Consuming app sets tool versions; plugin's `example/` app runs validation | [Test Flutter plugins][test-plugins] on AGP `9.1.1` and `9.3.1` | +[Check your versions][check-versions] to determine what your project needs: + +- **Projects meeting the minimums:** No changes are needed + if your Android project already uses AGP `9.1.1` through `9.x`, + Gradle `9.3.1` or later, Java 17 or later, + and [built-in Kotlin][] (or KGP `2.4.10` or later). + Updating to AGP `9.3.1`, Gradle `9.5.0`, and built-in Kotlin + (or KGP `2.4.20`) is optional and clears build warnings. +- **Projects below the minimums:** In your Flutter app or add-to-app host + project (including unmodified apps created with Flutter 3.47 or earlier), + update [AGP][update-agp], [Gradle][update-gradle], and + (when `android.builtInKotlin=false`) [KGP][update-kgp]. + Standalone Flutter modules regenerate `.android/` automatically + when you run `flutter pub get`. +- **Android plugins:** Consuming apps set the toolchain versions. + To validate your plugin's `example/` app, + refer to [Test Flutter plugins][test-plugins]. ## Background @@ -106,8 +113,6 @@ Inspect the build files and toolchain settings in your Flutter app - **AGP and KGP:** Check `plugins {}` in `android/settings.gradle.kts` (or `android/settings.gradle`), or check `gradle/libs.versions.toml`. - On projects created before Flutter 3.16, check the `buildscript` block in - `android/build.gradle`. Refer to [Update the Android Gradle Plugin][update-agp] and [Update the Kotlin Gradle Plugin][update-kgp]. - **Gradle:** Check the `distributionUrl` property in @@ -131,8 +136,8 @@ Before updating AGP, check two compatibility requirements: Update AGP to `9.3.1` (the Flutter 3.50 template default) to clear warnings, or to at least `9.1.1`. -On projects created with Flutter 3.16 or later, update the `plugins {}` block -in `android/settings.gradle.kts` (or `android/settings.gradle`). +Set the `com.android.application` version in the `plugins {}` block of +`android/settings.gradle.kts` (or `android/settings.gradle`). Code before migration: @@ -155,30 +160,6 @@ plugins { } ``` -On projects created before Flutter 3.16, update the `classpath` dependency in -`android/build.gradle` instead. - -Code before migration: - -```groovy title="/android/build.gradle" -buildscript { - dependencies { - classpath 'com.android.tools.build:gradle:8.11.1' - } -} -``` - -Code after migration: - -```groovy title="/android/build.gradle" -buildscript { - dependencies { - // Minimum in 3.50 is 9.1.1; 9.3.1 clears warnings (requires Gradle 9.5.0+). - classpath 'com.android.tools.build:gradle:9.3.1' - } -} -``` - ### Update Gradle Before updating the Gradle wrapper, check your Java and AGP versions: @@ -213,10 +194,8 @@ Skip this step if your project uses [built-in Kotlin][] (`android.builtInKotlin=true`). With `android.builtInKotlin=false`, update KGP to `2.4.20` to clear warnings, or to at least `2.4.10`. - -On projects created with Flutter 3.16 or later, update -`org.jetbrains.kotlin.android` in `android/settings.gradle.kts` -(or `android/settings.gradle`). +Set the `org.jetbrains.kotlin.android` version in the `plugins {}` block of +`android/settings.gradle.kts` (or `android/settings.gradle`). Code before migration: @@ -237,30 +216,6 @@ plugins { } ``` -On projects created before Flutter 3.16, update `ext.kotlin_version` in -`android/build.gradle` instead. -Unlike unpinned `plugins {}` declarations, FGP checks `ext.kotlin_version` -directly and fails validation below `2.4.10`. - -Code before migration: - -```groovy title="/android/build.gradle" -buildscript { - ext.kotlin_version = '2.2.20' - // ... -} -``` - -Code after migration: - -```groovy title="/android/build.gradle" -buildscript { - // Minimum when applied is 2.4.10; 2.4.20 clears warnings. - ext.kotlin_version = '2.4.20' - // ... -} -``` - Applying KGP is deprecated on AGP 9, and Flutter logs a warning when your app or a plugin applies it ([Issue 184837][]). To migrate off KGP instead of updating its version, follow the From af9b1cd58cdd89f7d742976af8424dcf4a6c7a87 Mon Sep 17 00:00:00 2001 From: Jessie Wong Date: Thu, 26 Nov 2026 00:39:24 +0000 Subject: [PATCH 6/9] Recommend one toolchain for plugin testing --- .../android-build-tool-minimum-versions.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index 545bb3d022..fc0b4c6011 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -225,15 +225,19 @@ To migrate off KGP instead of updating its version, follow the Flutter plugins compile with the AGP, Gradle, and KGP versions configured by the consuming app. -Verify your plugin's `example/` app against both supported configurations: - -- Minimum supported toolchain: AGP `9.1.1` with Gradle `9.3.1`. -- Template default toolchain: AGP `9.3.1` with Gradle `9.5.0`. - -Test each configuration with `android.builtInKotlin=false` and -`android.builtInKotlin=true` in `example/android/gradle.properties`. -For plugin migration steps, consult the -[built-in Kotlin guide for plugin authors][]. +Test your plugin's `example/` app with AGP `9.3.1` and Gradle `9.5.0`, +the Flutter 3.50 template defaults. +If your example app can't use those versions, test with at least +AGP `9.1.1` and Gradle `9.3.1`, the Flutter 3.50 minimums. + +Then test both values of `android.builtInKotlin` in +`example/android/gradle.properties`: + +- `android.builtInKotlin=false` confirms that the example app builds as-is. +- `android.builtInKotlin=true` confirms that the plugin is ready for + built-in Kotlin. + If the build fails, migrate your plugin by following the + [built-in Kotlin guide for plugin authors][]. ### Bypass the version check From 0385ed3e2454e8627e45a264d416ef934981c84a Mon Sep 17 00:00:00 2001 From: Jessie Wong Date: Thu, 26 Nov 2026 00:39:24 +0000 Subject: [PATCH 7/9] Clarify when Flutter adds Gradle properties --- .../android-build-tool-minimum-versions.md | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index fc0b4c6011..eef952d7d6 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -264,13 +264,17 @@ defaults with two Gradle properties in `android/gradle.properties`: - `flutter create` writes `android.builtInKotlin=false` and `android.newDsl=false` to new projects. -- When either property is missing, `flutter run` or `flutter build` appends it - with a marker comment. - Builds started directly from Gradle or Android Studio (including add-to-app - host builds) don't run that migrator. - -If you build directly from Gradle or Android Studio, confirm that your -project's `gradle.properties` file sets both properties: +- If either property is missing, the Flutter tool adds it the next time you + run `flutter run` or `flutter build`. + This includes running the Flutter project from an IDE such as + Android Studio or VS Code with the Flutter plugin, which calls + `flutter run`. +- Building with Gradle directly doesn't add the properties. + This includes `./gradlew`, opening the `android/` directory as an Android + Studio project, `flutter build aar`, and add-to-app host app builds. + +If you are building with Gradle directly, confirm that +`/android/gradle.properties` sets both properties: ```properties title="/android/gradle.properties" # Keep legacy KGP and DSL compatibility until your app and plugins migrate. @@ -278,6 +282,11 @@ android.builtInKotlin=false android.newDsl=false ``` +:::note +For add-to-app, set the same properties in +`/gradle.properties`. +::: + Use the following guides when you're ready to adopt the AGP 9 defaults: - To migrate to built-in Kotlin (`android.builtInKotlin=true`), follow From dbc5af6379f26d621a139ac8834ad8d6af5b20a1 Mon Sep 17 00:00:00 2001 From: Jessie Wong Date: Thu, 26 Nov 2026 00:39:25 +0000 Subject: [PATCH 8/9] Reword built-in Kotlin migration bullet --- .../android-build-tool-minimum-versions.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index eef952d7d6..6eba99407e 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -289,8 +289,16 @@ For add-to-app, set the same properties in Use the following guides when you're ready to adopt the AGP 9 defaults: -- To migrate to built-in Kotlin (`android.builtInKotlin=true`), follow - [Migrating Flutter Android projects to built-in Kotlin][built-in Kotlin]. +- To prepare for `android.builtInKotlin=true`, migrate to built-in Kotlin by + following + [Migrating Flutter Android projects to built-in Kotlin][built-in Kotlin], + which contains the migration guides + [for app developers][built-in Kotlin guide for app developers] and + [for plugin authors][built-in Kotlin guide for plugin authors]. + That migration applies only to apps and plugins that apply KGP + (`kotlin-android` or `org.jetbrains.kotlin.android`) in + `build.gradle` or `build.gradle.kts`. + If your project doesn't apply KGP, don't migrate to built-in Kotlin. - To prepare custom build scripts for `android.newDsl=true`, consult [Extend the Android Gradle Plugin][Variant API]. Flutter 3.50 defaults to `android.newDsl=false`, keeping legacy AGP From b95465289b967830bba14e46d3166abcb7a09692 Mon Sep 17 00:00:00 2001 From: Jessie Wong Date: Mon, 30 Nov 2026 21:26:56 +0000 Subject: [PATCH 9/9] Remove bypass the version check section --- .../android-build-tool-minimum-versions.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md index 6eba99407e..4c3e44b31c 100644 --- a/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md +++ b/sites/docs/src/content/release/breaking-changes/android-build-tool-minimum-versions.md @@ -239,22 +239,6 @@ Then test both values of `android.builtInKotlin` in If the build fails, migrate your plugin by following the [built-in Kotlin guide for plugin authors][]. -### Bypass the version check - -:::caution Unsupported flag -Bypassing dependency validation is unsupported. -FGP calls AGP 9 APIs that older versions don't provide, -so your build can still fail. -::: - -If you can't update your build tools immediately, pass -`--android-skip-build-dependency-validation` to `flutter run`, -`flutter build apk`, or `flutter build appbundle`: - -```bash -flutter build apk --android-skip-build-dependency-validation -``` - ## Built-in Kotlin and the new AGP DSL AGP 9 enables [built-in Kotlin][] by default (rejecting the `kotlin-android`