Skip to content

[AGP 9] Migrate plugins to support AGP 9#11802

Merged
auto-submit[bot] merged 31 commits into
flutter:mainfrom
jesswrd:migrate-all-plugins-bk
Jun 2, 2026
Merged

[AGP 9] Migrate plugins to support AGP 9#11802
auto-submit[bot] merged 31 commits into
flutter:mainfrom
jesswrd:migrate-all-plugins-bk

Conversation

@jesswrd
Copy link
Copy Markdown
Contributor

@jesswrd jesswrd commented May 29, 2026

Continuation of this PR: #11798

Migrates the rest of the plugins (and their respective example apps) that apply KGP to Built-in kotlin. Added validation for the plugin's build.gradle(.kts)

Will migrate all example apps to built-in kotlin and add validation for example apps here.

Fixes flutter/flutter#187261

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

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.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@github-actions github-actions Bot removed the CICD Run CI/CD label May 29, 2026
@jesswrd jesswrd added the CICD Run CI/CD label May 29, 2026
@github-actions github-actions Bot added platform-ios CICD Run CI/CD and removed CICD Run CI/CD labels May 29, 2026
@jesswrd jesswrd removed override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels May 30, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request migrates multiple Android plugin packages and their example apps to built-in Kotlin to support AGP 9, updates the minimum supported SDK version to Flutter 3.44/Dart 3.12, and updates the repository's Gradle validator tool to enforce these new conventions. Feedback on the changes includes: updating the automatically added android.builtInKotlin and android.newDsl flags to true in gradle.properties to prevent compilation failures; fixing a potential crash in the Gradle validator when javaVersions is empty, as well as correcting its nested block detection logic; and removing redundant try-catch blocks in the integration tests for file_selector_android and quick_actions_android where SDK version checks already handle the restricted broadcast.

Comment thread script/tool/lib/src/validators/gradle_validator.dart Outdated
Comment on lines +161 to +165
try {
context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
} catch (SecurityException e) {
// Suppress exception on Android 12+ where this broadcast is restricted.
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since Build.VERSION.SDK_INT >= Build.VERSION_CODES.S is checked and returns early at the beginning of the method, the try-catch block catching SecurityException is redundant. The restriction on ACTION_CLOSE_SYSTEM_DIALOGS and the resulting SecurityException are only present on Android 12 (S) and above.

    context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This makes sense; is there a reason we need both?

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.

I can't find the presubmit for this change. I think I was trying to fix an error from a test? Or perhaps this was the suggested fix for a timeout error (although its possible there werent any available testing devices, resulting in a timeout error).

Regardless, I reverted to to main and ran things locally. Everything passed.

Comment thread script/tool/lib/src/validators/gradle_validator.dart
Comment thread packages/image_picker/image_picker_android/android/src/main/AndroidManifest.xml Outdated
Comment on lines +161 to +165
try {
context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
} catch (SecurityException e) {
// Suppress exception on Android 12+ where this broadcast is restricted.
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This makes sense; is there a reason we need both?

<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent>
</queries>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We shouldn't force these permissions on applications, because the common use case doesn't do any queries. The recommended approach is to try to do the launch, and have a fallback if it fails.

What error happens if we don't add this? We should find some other solution for 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.

Ah thanks for the explanation.

This is QueryPermissionsNeeded lint error: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8680450101693408593/+/u/Run_package_tests/lint/stdout?format=raw#:~:text=Lint%20found%201,resolveActivity(context.getPackageManager())%3B

I'm going to remove the AndroidManifest.xml changes and suppress the lint for most of the bad calls because they technically have fallbacks here (or null assignments here) when the query fails.

Comment thread script/tool/lib/src/validators/gradle_validator.dart Outdated
Comment thread script/tool/test/validate_command_gradle_test.dart
Comment thread script/tool/test/validate_command_gradle_test.dart
jesswrd added 4 commits June 1, 2026 13:20
… try catch with a log message. Added a test to see if the message is logged when the activity fails to query.
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 1, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 1, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 1, 2026
@jesswrd jesswrd added the CICD Run CI/CD label Jun 1, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 2, 2026
@jesswrd jesswrd added the CICD Run CI/CD label Jun 2, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 2, 2026
@jesswrd jesswrd added the CICD Run CI/CD label Jun 2, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 2, 2026
@jesswrd jesswrd added the CICD Run CI/CD label Jun 2, 2026
@jesswrd jesswrd requested a review from stuartmorgan-g June 2, 2026 07:55
Copy link
Copy Markdown
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM!

@jesswrd jesswrd added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 2, 2026
@auto-submit auto-submit Bot merged commit 6441245 into flutter:main Jun 2, 2026
87 checks passed
pull Bot pushed a commit to edisplay/flutter that referenced this pull request Jun 3, 2026
…r#187511)

flutter/packages@818b310...b11504f

2026-06-02 fluttergithubbot@gmail.com Sync release-go_router-17.3.0 to
main (flutter/packages#11824)
2026-06-02 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump the test-dependencies group across 2 directories with
1 update (flutter/packages#11818)
2026-06-02 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump the androidx group across 10 directories with 1
update (flutter/packages#11511)
2026-06-02 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump org.json:json from 20251224 to 20260522 in
/packages/in_app_purchase/in_app_purchase/example/android/app
(flutter/packages#11775)
2026-06-02 echo.ellet@gmail.com [platform] Update README link to the new
repo (flutter/packages#11811)
2026-06-02 engine-flutter-autoroll@skia.org Roll Flutter from
54e199a to 701665b (26 revisions) (flutter/packages#11822)
2026-06-02 louisehsu@google.com Clarify documentation gaps, update
examples, add warning to ensure `completePurchase` is being called
(flutter/packages#11601)
2026-06-02 jessiewong401@gmail.com [AGP 9] Migrate plugins to support
AGP 9 (flutter/packages#11802)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AGP 9] Migrate flutter/packages to support AGP 9

2 participants