[AGP 9] Migrate plugins to support AGP 9#11802
Conversation
…in" to avoid test crash from mapping to a null
…ase. we are only accessing private apis in below api 28 so the lint is safe to add
…ther packages, they must be whitelisted
…into migrate-all-plugins-bk
There was a problem hiding this comment.
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.
| try { | ||
| context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); | ||
| } catch (SecurityException e) { | ||
| // Suppress exception on Android 12+ where this broadcast is restricted. | ||
| } |
There was a problem hiding this comment.
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));There was a problem hiding this comment.
This makes sense; is there a reason we need both?
There was a problem hiding this comment.
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.
| try { | ||
| context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); | ||
| } catch (SecurityException e) { | ||
| // Suppress exception on Android 12+ where this broadcast is restricted. | ||
| } |
There was a problem hiding this comment.
This makes sense; is there a reason we need both?
| <action android:name="android.intent.action.VIEW" /> | ||
| <data android:scheme="sms" /> | ||
| </intent> | ||
| </queries> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…h the lines inside the android block.
…ebug for packageDebugUnitTestForUnitTest
…assigns var to null if the query fails.
… try catch with a log message. Added a test to see if the message is logged when the activity fails to query.
…s-bk' into migrate-all-plugins-bk
…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
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
[shared_preferences]///).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-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.Footnotes
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