[AGP 9] Update templates to AGP 9+ and to Built-in Kotlin#185953
Merged
Conversation
Contributor
Author
Done. New preview sdk Baklava has been uploaded to CIPD: https://chrome-infra-packages.appspot.com/p/flutter/android/sdk/all/linux-amd64/+/version:baklava_v1. the shard configs in |
reidbaker
approved these changes
May 5, 2026
This was referenced May 5, 2026
This was referenced May 6, 2026
auto-submit Bot
pushed a commit
that referenced
this pull request
May 7, 2026
This was a manual cherry pick of #185953. ### Issue Link: What is the link to the issue this cherry-pick is addressing? #186100 ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping of production apps (the app crashes on launch). This information is for domain experts and release engineers to understand the consequences of saying yes or no to the cherry pick. All newly created Flutter Android apps, plugins, and add-to-app scenarios. ### Changelog Description: Explain this cherry pick: * In one line that is accessible to most Flutter developers. * That describes the state prior to the fix. * That includes which platforms are impacted. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples. < Replace with changelog description here > [flutter/186100](#186100): When Flutter Android apps, plugins, and app-to-app scenarios are newly created, they will be on AGP 9 and be migrated to Built-in Kotlin. ### Workaround: Is there a workaround for this issue? This change must be made. If we upgrade to AGP 9, we must migrate off of Built-in Kotlin. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? - `flutter create` a new app then run `flutter build apk` - `flutter create` a new plugin then navigate to the example project and run `flutter build apk` - follow the instructions for add-to-app scenarios [here](https://docs.flutter.dev/add-to-app/android/project-setup). If you can sucessfully run the android host project `./gradlew :assembleDebug`, your build was successful.
This was referenced May 7, 2026
5 tasks
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are the minimum required changes to update our templates to AGP 9. Narrowed the scope from here. This must be CP'ed to beta and stable.
Bumped templates to AGP 9 to ensure all newly created Flutter apps are on AGP 9 (and do not get the KGP warning).
AGP: 9.0.1
Gradle: 9.1.0
KGP: 2.3.20
Since any app, module, or plugin created via
flutter createshould be modern and correct, all templates must be migrated to Built-in Kotlin. Migrated app, module, and plugin templates from KGP to Built-in Kotlin Built-in Kotlin. Even though all necessary changes have been made to migrate to Built-in Kotlin, Flutter does not support actually using Built-in Kotlin because the default is still the legacy (by design).Fixes #186100
Fixed some breaking changes when upgrading templates:
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.