Skip to content

[AGP 9] Update templates to AGP 9+ and to Built-in Kotlin#185953

Merged
auto-submit[bot] merged 25 commits into
flutter:masterfrom
jesswrd:agp-just-temp
May 5, 2026
Merged

[AGP 9] Update templates to AGP 9+ and to Built-in Kotlin#185953
auto-submit[bot] merged 25 commits into
flutter:masterfrom
jesswrd:agp-just-temp

Conversation

@jesswrd

@jesswrd jesswrd commented May 3, 2026

Copy link
Copy Markdown
Contributor

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 create should 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:

  • android projects that contain similar package names fail to build starting AGP 9 here.
  • compileSdkVersion was deprecated in AGP < 9 and completely removed in AGP 9 here.
  • Java 17 is the new minimum for Gradle 9+ here. This is a no-op (except for unit tests) on our end because Java 17 has been the minimum for AGP since AGP 8. Due to this, the warning message cites Gradle version as the reason Java must be bumped instead of the AGP version.

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-assist bot 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.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 3, 2026
@github-actions github-actions Bot added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. team-android Owned by Android platform team labels May 3, 2026
@jesswrd jesswrd changed the title AGP 9 template [wip] AGP 9 template May 3, 2026
@github-actions github-actions Bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. f: integration_test The flutter/packages/integration_test plugin and removed CICD Run CI/CD labels May 4, 2026
@jesswrd jesswrd added the CICD Run CI/CD label May 4, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 4, 2026
@jesswrd jesswrd added the CICD Run CI/CD label May 4, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 4, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 4, 2026
@jesswrd jesswrd added the CICD Run CI/CD label May 5, 2026
@jesswrd

jesswrd commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

LGTM contingent on getting baklava pre installed on the shard using cipd in the manner that UDC was

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 ci.yaml have been updated to test against Baklava.

@jesswrd
jesswrd requested review from gmackall and reidbaker May 5, 2026 07:02
@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label May 5, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue May 5, 2026
Merged via the queue into flutter:master with commit ff31522 May 5, 2026
173 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 5, 2026
@jesswrd jesswrd added cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch labels May 5, 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.
@jesswrd jesswrd changed the title AGP 9 template [AGP 9] Update templates to AGP 9+ and Migrate to Built-in Kotlin Jul 13, 2026
@jesswrd jesswrd mentioned this pull request Jul 13, 2026
4 tasks
@jesswrd jesswrd changed the title [AGP 9] Update templates to AGP 9+ and Migrate to Built-in Kotlin [AGP 9] Update templates to AGP 9+ and to Built-in Kotlin Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests CICD Run CI/CD cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch f: integration_test The flutter/packages/integration_test plugin framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically team-android Owned by Android platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AGP 9] Update Template to AGP 9

3 participants