Skip to content

[CP-beta] [AGP 9] Update AGP Error With Flutter Docs (#185043)#186040

Merged
auto-submit[bot] merged 1 commit into
flutter:flutter-3.44-candidate.0from
jesswrd:cp-beta-rem-error
May 6, 2026
Merged

[CP-beta] [AGP 9] Update AGP Error With Flutter Docs (#185043)#186040
auto-submit[bot] merged 1 commit into
flutter:flutter-3.44-candidate.0from
jesswrd:cp-beta-rem-error

Conversation

@jesswrd
Copy link
Copy Markdown
Contributor

@jesswrd jesswrd commented May 5, 2026

AGP is ready to use. Developers should not be running into this error at all due to support that has been added for Built-in Kotlin #184836. But in the event that they do run into this error, they will be guided to the right docs: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin.

Issue Link:
What is the link to the issue this cherry-pick is addressing?

#186097

Impacted Users: Flutter Android devs who have updated to AGP 9+ and are applying the Kotlin Gradle Plugin. Users only see this error message if they still somehow receive the android provided error message even after we added support for both Built-in Kotlin and KGP.

Impact Description: To communicate AGP is ready to use and to add useful Flutter docs for migration to Built-in Kotlin.

Changelog Description:
flutter/186097: For Flutter apps on AGP 9+ and opted-in to built-in Kotlin without proper migration and the Flutter support for both Built-in Kotlin and KGP fails here, we will provide a Flutter error message.

Workaround: Updating error message so N/A

Risk: Very low risk
Test Coverage: yes confident
Validation Steps: unit tests or trigger the Android provided error (highly unlikely given we added support)

AGP is ready to use. Developers should not be running into this error at
all due to support that has been added for Built-in Kotlin
flutter#184836. But in the event that
they do run into this error, they will be guided to the right docs.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 5, 2026
@flutter-dashboard
Copy link
Copy Markdown

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions Bot added tool Affects the "flutter" command-line tool. See also t: labels. team-android Owned by Android platform team labels May 5, 2026
@jesswrd jesswrd changed the title [AGP 9] Update AGP Error (#185043) [CP-beta] [AGP 9] Update AGP Error With Flutter Docs (#185043) May 5, 2026
@jesswrd jesswrd added the cp: review Cherry-picks in the review queue label May 5, 2026
@jesswrd jesswrd marked this pull request as ready for review May 5, 2026 06:42
@jesswrd jesswrd requested a review from a team as a code owner May 5, 2026 06:42
@jesswrd jesswrd requested review from mboetger and removed request for a team May 5, 2026 06:42
Copy link
Copy Markdown
Contributor

@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 replaces the general AGP 9 migration warning with specific documentation URLs for built-in Kotlin migration and opting out of the new DSL. It updates the error handlers to use these URLs and simplifies the output messages. Corresponding unit tests were updated to reflect these changes. Feedback identifies a potential test failure due to an extra space in a string expectation and suggests a grammatical fix for an error message.

contains(
'Starting AGP 9+, the default has become built-in Kotlin. This results in a build failure when',
),
contains(' This results in a build failure when applying the kotlin-android plugin'),
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.

high

This test expectation contains a leading space that is no longer present in the actual error message. In the updated gradle_errors.dart, the string 'This results...' starts on a new line in the multi-line block without any preceding space. This mismatch will cause the test to fail.

Suggested change
contains(' This results in a build failure when applying the kotlin-android plugin'),
contains('This results in a build failure when applying the kotlin-android plugin'),

Copy link
Copy Markdown
Contributor

@reidbaker reidbaker May 6, 2026

Choose a reason for hiding this comment

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

well it doesnt look like this test failed

\nTo resolve this update flutter or opt out of `android.newDsl`. For instructions on how to opt out, see: https://docs.flutter.dev/release/breaking-changes/migrate-to-agp-9
${globals.logger.terminal.warningMark} Starting AGP 9+, only the new DSL interface will be read.
This results in a build failure when applying the Flutter Gradle plugin at ${appGradleFile.path}.
\nTo resolve this update flutter or opt out of `android.newDsl`.
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.

medium

The sentence is missing a comma after 'this' and 'Flutter' should be capitalized for consistency with other error messages and proper naming of the framework.

Suggested change
\nTo resolve this update flutter or opt out of `android.newDsl`.
\nTo resolve this, update Flutter or opt out of `android.newDsl`.
References
  1. Optimize for readability. Code is read more often than it is written. (link)

@jesswrd jesswrd requested review from reidbaker and removed request for mboetger May 5, 2026 20:20
@walley892 walley892 added the autosubmit Merge PR when tree becomes green via auto submit App label May 6, 2026
@auto-submit auto-submit Bot merged commit 5867146 into flutter:flutter-3.44-candidate.0 May 6, 2026
154 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD cp: review Cherry-picks in the review queue 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.

3 participants