Skip to content

[Android] Add Flutter 3.50 breaking-change page for the Flutter Gradle Plugin Variant API migration - #14053

Open
reidbaker-agent wants to merge 30 commits into
flutter:mainfrom
reidbaker-agent:android-3.50-build-breaking-changes
Open

reidbaker-agent wants to merge 30 commits into
flutter:mainfrom
reidbaker-agent:android-3.50-build-breaking-changes

Conversation

@reidbaker-agent

@reidbaker-agent reidbaker-agent commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description of what this PR is changing or adding, and why:

Adds the Flutter 3.50 Android breaking-change and migration guide
Flutter Gradle Plugin uses the Android Gradle Plugin Variant API
(/release/breaking-changes/flutter-gradle-plugin-variant-api)
and lists the page under "Released in Flutter 3.50" in the breaking-changes
index:

Companion PR for raised minimum Android build tool versions in Flutter 3.50:
#14090

Issues fixed by this PR (if any):

PRs or commits this PR depends on (if any):

Presubmit checklist

  • If you are unwilling, or unable, to sign the CLA, even for a tiny, one-word PR, please file an issue instead of a PR.
  • If this PR is not meant to land until a future stable release, mark it as draft with an explanation.
  • This PR follows the Google Developer Documentation Style Guidelines—for example, it doesn't use i.e. or e.g., and it avoids I and we (first-person pronouns).
  • This PR uses semantic line breaks
    of 80 characters or fewer.

Adds two breaking-change pages for the Flutter 3.50 stable release and
lists them in the index:

- Raised minimum Android build tool versions: AGP 9.1.1, Gradle 9.3.1,
  KGP 2.4.10 (when applied), AGP 10 unsupported, and how built-in
  Kotlin and the new AGP DSL properties interact with the upgrade.
- Flutter Gradle Plugin uses the Android Gradle Plugin Variant API:
  user-visible behavior changes from migrating the Flutter Gradle
  Plugin to public AGP APIs (APK copy task, per-ABI versionCode,
  custom build types, assets, add-to-app, flutter build aar) and a
  migration guide for legacy applicationVariants usage.

Fixes flutter/flutter#193713 (publishes the website-page-draft).
- Call out that projects created with Flutter 3.44/3.47 templates
  (AGP 9.0.1/9.1.0, KGP 2.3.20/2.4.0) are below the new minimums.
- Correct the AGP error message sample and the AGP 10 message.
- Clarify when the KGP check applies (Flutter auto-applies KGP when
  android.builtInKotlin=false), and that checks run before the plugin
  reads the Android DSL rather than 'before anything else'.
- Fix apkanalyzer command (manifest version-code).
- Describe the 3.50 migrator behavior for android.newDsl accurately and
  document opting in with android.newDsl=true + android.builtInKotlin=true.
- Note finalizeDsl ordering for versionCode and where the
  flutter.hostAppProjectName warning is visible.
@sfshaza2

sfshaza2 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

@reidbaker, should this be in draft? Let me know if we should get this moving...

@reidbaker

Copy link
Copy Markdown
Member

@reidbaker, should this be in draft? Let me know if we should get this moving...

Yes it should be until I review it and say it is ready for human (non agent) eyes.

@reidbaker
reidbaker self-requested a review November 11, 2026 21:10
- Apply plain-language and flutter/website style conventions across both
  3.50 Android build breaking-change pages (imperative task headings,
  explicit affected vs unaffected triage, `-` list markers, no manual
  table footnotes or inflected code spans, and semantic line breaks).
- Fix technical findings verified against Flutter 3.50.0:
  - Clarify how to inspect current AGP/Gradle/KGP/JDK versions and what
    `flutter analyze --suggestions` actually reports.
  - Complete the trimmed AGP error message, add 3.44 template Gradle
    9.1.0 and Gradle/KGP no-advance-warning ranges, and fix the broken
    AGP/Gradle compatibility table anchor (`about-agp#updating-gradle`).
  - Clarify that KGP still must be >= 2.4.10 when `builtInKotlin=false`.
  - Fix `copyFlutterApks<Variant>` visibility (`./gradlew tasks --all`),
    3.47 library plugin build-type copying, softened `LibraryBuildType`
    debuggability note, `onVariants` task lookup (`tasks.matching`),
    preview `compileSdk` comparison, `flutter run`/`flutter build`
    migrator scope, Timeline pre-release versions, and master PR links.
  - Replace `[-<abi>][-<flavor>]` inline code notation that triggered
    `dash_site check-link-references` failures.
- Add dedicated split-per-ABI `versionCode` migration guidance and the
  `-P force-version-code-ignoring-abi=true` escape hatch, with explicit
  `TODO(reidbaker)` blocks for the undecided `flutter/flutter#196561`
  `3.50.x` cherry-pick.

@reidbaker reidbaker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High level feedback. Sort the information based one value to the reader and remove information that users do not need to know or take action on.

Information about the migration that is not relevant to flutter app developers distracts from the information we want them to pay attention to.

Comment on lines +119 to +121
`TODO(reidbaker)`: confirm the cherry-picks landed and fill in the `3.50.x`
versions on this page ([PR 196561][] for split-per-ABI `versionCode`;
[PR 196692][] for plugin build types).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont want to leave this todo in this pr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the in-page TODO block and replaced the 3.50.x placeholders with Flutter 3.50.1 in 295ba7d. The cherry-pick dependencies remain tracked in the PR description while this PR stays in draft.

[PR 196692][] for plugin build types).
:::

This change has two main effects:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the concept of "this change" is weird for the flutter website. We are trying to document what impact including breaking changes happen as part of the new dsl migration and specifically the changes that need more information from 3.50.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote the page in 295ba7d around user-visible impact in Flutter 3.50 and 3.50.1 rather than PR-centric "this change" framing, and folded the separate "Description of change" section into task-focused migration sections.

Passing `-P force-version-code-ignoring-abi=true` still disables Flutter's
per-ABI offset completely.

### App build types copied to plugins

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a title that requires that readers already know what they are looking for. Try to structure the titles so that a flutter dev who does not already understand the changes can find the information they need.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the section headings in 295ba7d around developer tasks and project configurations rather than FGP internals: "Customize version codes in Gradle build scripts", "Fix split-per-ABI version code errors", "Configure profile and custom build types", "Rename, copy, or transform APK outputs", and "Configure Flutter Gradle tasks in build scripts".

Comment on lines +190 to +193
- Flutter no longer copies `isMinifyEnabled` (which Flutter 3.47 copied).
Minifying a library plugin runs R8 with only the plugin's keep rules,
stripping plugin classes referenced by `GeneratedPluginRegistrant`,
and the app's R8 pass already shrinks plugin code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems distracting to mention if it is not a difference from 3.47 and if there is no action devs need to take or know about.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the internal plugin build-type copying details (isMinifyEnabled, isDebuggable casts, and com.android.application initWith behavior) in 295ba7d, keeping only actionable guidance (matchingFallbacks on custom build types and upgrading to Flutter 3.50.1).

Comment on lines +195 to +200
In Flutter `3.50.0` ([PR 191606][]), FGP called `initWith(appBuildType)` on
library plugins too.
Because `initWith` copies every build type property, apps with Android plugins
failed during Gradle configuration—even for `flutter run` in debug mode—when
`profile` or a custom build type set properties that AGP rejects in libraries
([Issue 196412][], [Issue 196696][]):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets communicate these as reasons to use 3.50.1 and describe them as issues fixed in 3.50.1.

Also we dont need to duplicate all the information that is in the bug and in the pull request. This page is for users. Share what they need to know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a "Use Flutter 3.50.1 or later" callout in Summary and trimmed "Configure profile and custom build types" in 295ba7d to present the 3.50.0 regressions as issues fixed in Flutter 3.50.1, linking the issues instead of duplicating the per-property AGP breakdown and 3.50.0 Gradle workaround.

Comment on lines +218 to +228
### Flutter assets are a generated source directory

Flutter's `flutter_assets` directory is now registered on each variant as a
generated assets source directory (`addGeneratedSourceDirectory`).
Previously, Flutter copied these files into AGP's merged assets output directory
after `merge<Variant>Assets`, and `process<Variant>Resources` depended on
`flutter assemble`.
Now AGP merges `flutter_assets` in the variant overlay—taking precedence over
static `src/main/assets` unless a later `onVariants` callback registers another
assets directory—and `process<Variant>Resources` no longer waits on
`flutter assemble`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do users need to know this? if not remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the "Flutter assets are a generated source directory" section in 295ba7d. Added only a brief migration note under "Configure Flutter Gradle tasks in build scripts" for scripts or tests that read build/app/intermediates/assets/<variant>/merge<Variant>Assets/flutter_assets/ (which changed in 3.50.1 via flutter/flutter#196465 and should read packaged assets from the built APK or AAB instead).

uploading the set to Google Play.
:::

### Set per-ABI or per-variant `versionCode` values

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be higher in the page. It is one of the more subtle issues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved "Customize version codes in Gradle build scripts" to the first bullet in Summary and the first section under Migration guide in 295ba7d, ahead of split-per-ABI missing-versionCode errors, build types, APK outputs, task lookups, add-to-app, and plugins.

Comment on lines +593 to +594
Landed in version: 3.49.0-0.1.pre, 3.50.0-0.1.pre, and 3.50.0-0.4.pre<br>
In stable release: 3.50

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets not talk about pre release versions in this documenation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the pre-release versions from Timeline in 295ba7d, leaving In stable release: 3.50 (and applied the same change in #14090).

[PR 193962]: {{site.repo.flutter}}/pull/193962
[PR 195640]: {{site.repo.flutter}}/pull/195640
[PR 196561]: {{site.repo.flutter}}/pull/196561
[PR 196692]: {{site.repo.flutter}}/pull/196692

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am skeptical of the value of this whole section. If it is relevent it should be much more clear what the value is and why it is worth the readers attention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trimmed References in 295ba7d down to four reader-facing links (the Android Variant API documentation, the built-in Kotlin migration guide, and tracking issues flutter/flutter#180137 and flutter/flutter#190845), each stating why to visit or follow it, and removed the deleted contributor doc link.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break this into a different pull request. Add @jesswrd as a reviewer to that new pr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed android-build-tool-minimum-versions.md and its index entry from this PR in 295ba7d, and opened draft PR #14090 for it (reidbaker-agent lacks RequestReviewsByLogin permission on flutter/website, so jesswrd still needs to be added as a reviewer manually).

reidbaker pushed a commit to reidbaker-agent/flutter that referenced this pull request Nov 16, 2026
Migrating-Flutter-Gradle-Plugin-to-AGP-public-API.md was the work log for
the AGP 9.1.0 migration stack, and website-page-draft.md was the draft of
the user-facing page. The breaking-change pages in flutter/website#14053
are now the user-facing record. Point the FlutterPlugin.kt KDoc at that
page and drop the doc path from the InternalAgpApiImportTest message.
@reidbaker-agent reidbaker-agent changed the title [Android] Add Flutter 3.50 breaking-change pages for build tool minimums and the Flutter Gradle Plugin Variant API migration [Android] Add Flutter 3.50 breaking-change page for the Flutter Gradle Plugin Variant API migration Nov 16, 2026
@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

@flutter-website-bot

flutter-website-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Staged preview of the updated docs.flutter.dev site (updated for commit 68193c1):

https://flutter-docs-prod--docs-pr14053-android-3-50-build-bre-3jt6dd3t.web.app

## Summary

Android Gradle Plugin (AGP) 9 deprecated its legacy variant APIs,
and AGP 10 removes them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think that is true. Look for evidence that is public that says that or soften the language to something that indicates flutter believes they will or that we want to be prepared if they do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked Android's public documentation and AGP 9.3.1 bytecode:

  • AGP DSL/API migration timeline (AGP 10.0 -> What is being removed and replaced) states: "All previous interfaces and classes used in the legacy DSL and the old Variant API are deleted", listing applicationVariants, libraryVariants, testVariants, unitTestVariants, android.newDsl, and android.builtInKotlin under AGP 10.0 removals—with the top-level caveat "Note: The following timeframes are estimates and are subject to change."
  • AGP 9.0.0 release notes state: "Caution: The ability to opt-out will be removed in AGP 10.0 (mid-2026)."
  • AGP 9.4.0 release notes state: "Starting with AGP 10, the new Variant API is mandatory for all projects."
  • AGP 9.3.1 bytecode (com.android.tools.build:gradle:9.3.1): DeprecationTarget.LEGACY_VARIANT_API, BooleanOption.USE_NEW_DSL, BooleanOption.BUILT_IN_KOTLIN, and BooleanOption.ENABLE_LEGACY_API all set removalTarget = Version.VERSION_10_0.

Because AGP 10 hasn't shipped yet (the current preview on agp-preview is AGP 9.6.0-alpha05, and Android's timeline notes estimates are subject to change), updated in 2b78fa0 to link the AGP migration timeline directly and soften "AGP 10 removes them" to "the AGP migration timeline schedules their removal for AGP 10. To prepare, the Flutter Gradle Plugin (FGP) in Flutter 3.50 uses AGP's public Variant API..." (and updated the summary and triage table from "AGP 10 readiness" / "AGP 10 compatibility" to "test without legacy AGP APIs"). Also aligned the wording and #android-gradle-plugin-new-dsl / #agp-10 anchors in #14090 (6572df9).

### Opt in to the new AGP DSL early

AGP 9 deprecated the legacy DSL and variant APIs behind `android.newDsl=false`,
and AGP 10 removes both `android.newDsl=false` and the legacy APIs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also mentioned here. I need to see some public evidence if we are going to keep this statement.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 2b78fa0 to link both public Android sources directly and soften "AGP 10 removes..." to scheduled removal:

  • AGP 9.0.0 release notes (#android-gradle-plugin-new-dsl): documents android.newDsl=false and states "Caution: The ability to opt-out will be removed in AGP 10.0 (mid-2026)."
  • AGP DSL/API migration timeline (#agp-10): lists android.newDsl and applicationVariants / libraryVariants under What is being removed and replaced for AGP 10.0 (with "Note: The following timeframes are estimates and are subject to change"), and notes under #agp-10-opt-out-subproject: "will be removed along with android.newDsl in AGP 10.0."

The section now links both pages and reads: "AGP 9 enables the new AGP DSL by default and deprecates the legacy DSL and variant APIs behind android.newDsl=false. The AGP migration timeline schedules the removal of android.newDsl=false and the legacy variant APIs for AGP 10."

@reidbaker
reidbaker marked this pull request as ready for review November 17, 2026 19:56
@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

Comment on lines +17 to +18
FGP no longer calls `android.applicationVariants`, `android.libraryVariants`,
`variant.outputs`, or `versionCodeOverride`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FGP no longer calls `android.applicationVariants`, `android.libraryVariants`,
`variant.outputs`, or `versionCodeOverride`.

End users dont need to know this as a top line entry.

Comment on lines +26 to +29
- Sets `versionCode = flutter.versionCode` in `defaultConfig`
(the Flutter template default),
or sets a positive decimal integer `android:versionCode` in
`src/main/AndroidManifest.xml`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Sets `versionCode = flutter.versionCode` in `defaultConfig`
(the Flutter template default),
or sets a positive decimal integer `android:versionCode` in
`src/main/AndroidManifest.xml`.
- Sets a positive integer `android:versionCode` in `src/main/AndroidManifest.xml`.
- Or uses `versionCode = flutter.versionCode` in `defaultConfig` which is the Flutter template default.

Also does the value have to be set in src/main/AndroidManifest.xml?

`src/main/AndroidManifest.xml`.
- Doesn't read or customize `versionCode` in `onVariants` or
`applicationVariants`, hook into Flutter's Gradle tasks or
`merge<Variant>Assets/` paths, or use custom add-to-app settings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`merge<Variant>Assets/` paths, or use custom add-to-app settings.
`merge<Variant>Assets/` paths, or use custom add-to-app settings (uncommon).

`merge<Variant>Assets/` paths, or use custom add-to-app settings.

Flutter 3.50 keeps `android.newDsl=false` by default,
so `android.applicationVariants` still works except in `--split-per-abi`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
so `android.applicationVariants` still works except in `--split-per-abi`
so apps that depend on `android.applicationVariants` still works except in `--split-per-abi`

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

Comment on lines +68 to +79
Match your role, build pattern, or Gradle error to its migration section:

| Role | Symptom, build pattern, or error | Migration section |
| :--- | :--- | :--- |
| App developer | Computes custom `versionCode` values in `onVariants`, `applicationVariants`, or `versionCodeOverride` | [Customize version codes in Gradle build scripts][vc-custom] |
| App developer | Hits `Querying the mapped value ... resolveManifestVersionCode<Variant>` or `CircularEvaluationException` on `versionCode` | [Customize version codes in Gradle build scripts][vc-custom] |
| App developer | Fails `--split-per-abi` with `Flutter cannot give ... variant '<name>' a versionCode` or `Circular dependency ... resolveManifestVersionCode<Variant>` (with or without `-P force-version-code-ignoring-abi=true`) | [Fix split-per-ABI version code errors][vc-split] |
| App developer | Sets `outputFileName`, copies APKs, or fails naming `SingleArtifact.APK` | [Rename, copy, or transform APK outputs][apk-outputs] |
| App developer | Hits `UnknownTaskException` or `ClassCastException` on `copyFlutterAssets<Variant>`, or reads `merge<Variant>Assets/` | [Configure Flutter Gradle tasks in build scripts][flutter-tasks] |
| App developer | Enables `android.newDsl=true` to test without legacy AGP APIs | [Opt in to the new AGP DSL early][opt-in] |
| Add-to-app or AAR | Logs a `flutter.hostAppProjectName` warning, uses custom host build types, or runs `flutter build aar --flavor` | [Update add-to-app projects and AAR builds][add-to-app] |
| Plugin author | Calls `android.libraryVariants`, `android.applicationVariants`, or Flutter's tasks in a plugin | [Migrate Android plugins][plugins] |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably not be a table almost all the entries are app developers and "Add-to-app or AAR" is also an app developer. The only entry that is not is the plugin developer so lets make that its own subtitle.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the role/symptom table with a bulleted Check whether your app needs updates list (including add-to-app and AAR) and a separate For plugin authors subtitle in 6aa630e.

Comment on lines +84 to +85
(`android.applicationVariants`, `android.libraryVariants`,
and `versionCodeOverride`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these api examples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the parenthetical legacy API list from Background in 6aa630e.

Comment on lines +105 to +109
With `flutter build apk --split-per-abi`, Flutter sets each ABI output's
`versionCode` to `abiOffset * 1000 + versionCode`
(`1` for `armeabi-v7a`, `2` for `arm64-v8a`, and `4` for `x86_64`).
If that default numbering fits your app,
you don't need a custom `versionCode` block.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should start with the change compared to the previous 3.47 version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote the opening of Customize version codes in Gradle build scripts in 6aa630e to lead with the 3.47 vs. 3.50 behavior change.

Comment on lines +116 to +129
Compute custom `versionCode` values from a base input you control,
such as `flutter.versionCode`, a product flavor's `versionCode`,
or your own Gradle `Provider`.
Don't read or map `output.versionCode` or legacy `variant.versionCode`:

- On manifest-only `--split-per-abi` builds, calling `output.versionCode.get()`,
`output.versionCode.orNull`, or legacy `variant.versionCode` or
`output.versionCode` fails at configuration with
`Querying the mapped value ... resolveManifestVersionCode<Variant>`.
- Calling `output.versionCode.set(output.versionCode.map { ... })` fails with
Gradle's `CircularEvaluationException`.
- Disabling `android.compatibility.enableLegacyApi` also blocks
configuration-time reads of `output.versionCode` when `defaultConfig` sets
`versionCode`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to hide this behind an expanded section. Most users are not going to follow this information. What they need to know is how to tell if they are impacted and how to get the behavior they want and why it matters. Perhaps lead with how to tell (compare a previous release to a 3.50 release with a command to get the in value when using split per abi).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked this section in 6aa630e to lead with the 3.47->3.50 change, why Google Play monotonic version codes matter, how to compare 3.47 vs. 3.50 APKs with apkanalyzer manifest version-code, and the fix. Moved the configuration-time errors and 3-way math table into an expandable <details> section.

Comment on lines +207 to +228
You need no changes here if `android {}` sets `versionCode` in `defaultConfig`
(such as `versionCode = flutter.versionCode`) or on each product flavor,
or if the main manifest (`src/main/AndroidManifest.xml` by default)
sets a positive decimal integer `android:versionCode` ([Issue 196559][]).
When `android {}` sets `versionCode`,
Flutter uses that DSL value and doesn't read any `AndroidManifest.xml`.
Non-split APKs, `flutter build appbundle`, and `flutter run` don't run this
check.
If you set `android:versionCode` only in the main manifest,
`--build-number` has no effect because that flag updates `flutter.versionCode`
only.

When `android {}` omits `versionCode`, Flutter matches AGP and reads
`android:versionCode` only from the main manifest.
Manifests in other source sets (build type, flavor, or variant) and
generated manifests don't count.
In Flutter 3.50.1 and later, `--split-per-abi` (or `-Psplit-per-abi=true`)
fails in `resolveManifestVersionCode<Variant>` when `android {}` omits
`versionCode` and the main manifest lacks a positive decimal
`android:versionCode`.
This check runs both by default and with
`-P force-version-code-ignoring-abi=true`:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A list of things that don't happen is hard for human readers in this context. Can you keep the technical details correct and focus on when devs should do something or how they can gain confidence the something they need to do works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote Fix split-per-ABI version code errors in 6aa630e to remove the list of things that don't happen and lead with when to act, the defaultConfig fix, and how to verify the output APKs with apkanalyzer.

Comment on lines +240 to +260
When `android {}` omits `versionCode`, common causes of this error are
omitting `android:versionCode` in `src/main/AndroidManifest.xml`, setting a
manifest value `<= 0`, or using `${vc}` placeholders, `@integer/...`
resources, or `0x...` hex literals.
In Flutter 3.50.0, omitting `versionCode` in `android {}` left split APKs
without per-ABI offsets (or with an empty `versionCode` when the manifest
also omitted it, which fails updates over a versioned build with
`INSTALL_FAILED_VERSION_DOWNGRADE`).
In Flutter 3.47 and earlier, `versionCodeOverride` added the per-ABI offset to
the legacy `variant.versionCode`: omitting `android:versionCode` defaulted to
`-1` (producing `999`, `1999`, and `3999`), values `<= 0` were offset as-is
(for example, `0` produced `1000`, `2000`, and `4000`), and non-decimal
manifest values failed with a `NumberFormatException`.
Without `-P force-version-code-ignoring-abi=true`, builds also fail if
`abiOffset * 1000 + versionCode` exceeds 2,147,483,647
(the highest base `versionCode` across all three ABIs is 2,147,479,647).
To fix missing, non-positive, or non-decimal manifest values, set
`versionCode = flutter.versionCode` in `defaultConfig` (or per flavor) and
remove `android:versionCode` from `AndroidManifest.xml`.
To share an existing positive `versionCode` across split APKs outside Google
Play, refer to [Keep a single version code across split APKs][vc-single].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This information is good but the presentation is super hard to follow for users new to the concepts being presented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broke up the dense edge-case paragraph in 6aa630e and moved the manifest causes, overflow limits, 3.50.0/3.47 history, and generated-manifest cycle into a bulleted <details> block.

Comment on lines +453 to +465
Code before migration:

```properties title="<host-app>/gradle.properties"
org.gradle.jvmargs=-Xmx4G
flutter.hostAppProjectName=my_host_app
```

Code after migration:

```properties title="<host-app>/gradle.properties"
org.gradle.jvmargs=-Xmx4G
# Remove flutter.hostAppProjectName; Flutter resolves module assets per variant.
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this before an after might be better conveyed through a diff like syntax instead of before and after blocks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted the small same-file before/after snippets (defaultConfig, copyFlutterAssetsDebug, hostAppProjectName, and matchingFallbacks) to diff code blocks in 6aa630e.

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun


### Check whether your app needs updates

Jump to any matching section below, or skip the rest of this page.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would "or skip the rest of this page." be a correct choice?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified the condition in 99c1ae3: 'Jump to any section below that matches your project. If none match, your app needs no migration changes for Flutter 3.50.'


#### Uncommon build patterns

Skip these unless your Gradle scripts or error logs match:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is "these" that should be skipped?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named the referent directly in 99c1ae3: 'Most apps don't use these patterns; skip the sections below unless your Gradle scripts or error logs match:'

Comment on lines +205 to +209
| ABI (`abiOffset`) | `flutter.versionCode`: `abiOffset * 1000 + 42 * 10000` | Unmigrated `variant.versionCode`: `abiOffset * 1000 + 1042 * 10000` | `onVariants` scaling `output.versionCode`: `(abiOffset * 1000 + 42) * 10000` |
| :--- | :--- | :--- | :--- |
| `armeabi-v7a` (1) | 421000 | 10421000 | 10420000 |
| `arm64-v8a` (2) | 422000 | 10422000 | 20420000 |
| `x86_64` (4) | 424000 | 10424000 | 40420000 |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this table supposed to show?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an intro sentence explaining what the table compares (expected version codes vs. inflated values when reading variant.versionCode or output.versionCode) and simplified the column headers in 99c1ae3.

Because `kotlin-android` rejects `android.newDsl=true`, keep both properties
`false` if any plugin still applies it.

Once both hold, enable the new DSL in `android/gradle.properties` (Flutter's

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once both hold, enable the new DSL in `android/gradle.properties` (Flutter's
Once both are true, enable the new DSL in `android/gradle.properties` (Flutter's

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 99c1ae3.

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

lamek pushed a commit that referenced this pull request Dec 1, 2026
…l versions (#14090)

_Description of what this PR is changing or adding, and why:_

Adds the Flutter 3.50 Android breaking-change and migration guide
**Raised minimum Android build tool versions**
(`/release/breaking-changes/android-build-tool-minimum-versions`,
split out from #14053)
and lists the page under "Released in Flutter 3.50" in the
breaking-changes
index:

- Documents the Flutter 3.50 minimums: AGP **9.1.1** (up from 8.11.1),
Gradle **9.3.1** (up from 8.14.0), and KGP **2.4.10** when KGP is
applied
  (up from 2.2.20), along with the Flutter 3.50 template defaults
(AGP 9.3.1, Gradle 9.5.0, KGP 2.4.20) and the validation error rejecting
  **AGP 10+**.
- Summarizes what projects need to do across projects already meeting
the
3.50 minimums, Flutter apps and add-to-app host projects below the
minimums
(including unmodified apps created with Flutter 3.47 or earlier),
standalone
  Flutter modules, and Android plugins.
- Provides copyable before/after snippets for `settings.gradle.kts`
  `plugins {}` blocks and `gradle-wrapper.properties`, plus guidance on
  `android.builtInKotlin=false`, and `android.newDsl=false`

> [!IMPORTANT]
> **Open question before marking ready for review:**
> Under `## Background`, the page links the [Android dependency versions
support policy](https://docs.flutter.dev/go/android-dependency-versions)
("warn for at least one stable release before raising the minimum"). In
Flutter 3.50, AGP `9.0.1`–`9.1.0`, Gradle `9.1.0`–`9.3.0`, and KGP
`2.3.20`–`2.4.9` fail validation without a prior warning in Flutter
3.47. Confirm whether to keep the page focused on the 3.50 minimums as
written, or add an explicit note that 3.50 made an exception to the
warning-cycle policy.

Companion PR for the Flutter Gradle Plugin Variant API migration guide:
#14053

_Issues fixed by this PR (if any):_

None.

_PRs or commits this PR depends on (if any):_

None.

## Presubmit checklist

- [x] If you are unwilling, or unable, to sign the CLA, even for a
_tiny_, one-word PR, please file an issue instead of a PR.
- [x] If this PR is not meant to land until a future stable release,
mark it as draft with an explanation.
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style)—for example, it doesn't
use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first-person
pronouns).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
  of 80 characters or fewer.

---------

Co-authored-by: Jessie Wong <jesswon@google.com>
@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

The ABI multipliers are 1 for `armeabi-v7a`, 2 for `arm64-v8a`, and 4 for
`x86_64`.

Scripts that add to or multiply that offset ship inflated version codes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to also highlight that if they are also multiplying by 1000 they could easily start running into the max integer value. WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good idea. Will incorporate.

@lamek

lamek commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Quick checklist of concrete items to fold into the next pass before merging:

  1. outputFileName vs. android.newDsl=false: Summary says legacy applicationVariants scripts keep running under android.newDsl=false with two exceptions, while the outputFileName section asks readers to migrate without saying whether it breaks in 3.50 or only under android.newDsl=true.
  2. android.builtInKotlin forward reference: Under Opt in to the new AGP DSL early, the prose says "keep both properties false" before android.builtInKotlin is mentioned outside the code block.
  3. Double-offset table math: In the <details> table under Customize version codes in Gradle build scripts, the Double-offset (output.versionCode) column (10420000 / 20420000 / 40420000) drops + abiOffset * 1000 from the Before snippet's formula (10421000 / 20422000 / 40424000), and the line right above it ends in a stray colon.
  4. Link phrasing (AGENTS.md): Lines 315, 389, and 566 still use , see [...] / ; see [...] instead of refer to or consult.
  5. Also +1 to @mboetger's comment on noting the 32-bit Int.MAX_VALUE overflow risk when multiplying an already-offset versionCode.

From Kevin by way of Agent Dash.

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

1 similar comment
@reidbaker

Copy link
Copy Markdown
Member

/gcbrun

@lamek
lamek self-requested a review December 4, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish the Flutter Gradle Plugin AGP public API breaking-change page to docs.flutter.dev and update links to it

7 participants