Skip to content

[AGP 9] Update AGP Error#185043

Merged
auto-submit[bot] merged 1 commit intoflutter:masterfrom
jesswrd:agp-usable
Apr 15, 2026
Merged

[AGP 9] Update AGP Error#185043
auto-submit[bot] merged 1 commit intoflutter:masterfrom
jesswrd:agp-usable

Conversation

@jesswrd
Copy link
Copy Markdown
Contributor

@jesswrd jesswrd commented Apr 14, 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.

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.

@jesswrd jesswrd requested a review from a team as a code owner April 14, 2026 18:13
@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 Apr 14, 2026
@jesswrd jesswrd added the CICD Run CI/CD label Apr 14, 2026
Copy link
Copy Markdown
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

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

"Developers should not be running into this error at all due to . " Due to what?

@reidbaker
Copy link
Copy Markdown
Contributor

/gemini review

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 generic AGP 9 warning with specific documentation URLs and updated error messages in gradle_errors.dart, while updating the corresponding test suite. Feedback suggests restoring the file path in the Kotlin migration error message for consistency, correcting grammar and capitalization in the DSL opt-out message, and fixing a spacing mismatch in the test expectations to prevent test failures.

Comment on lines +686 to +690
globals.printBox('''
${globals.logger.terminal.warningMark} Starting AGP 9+, the default has become built-in Kotlin.
This results in a build failure when applying the kotlin-android plugin.
To resolve this, migrate to built-in Kotlin.
\nFor instructions on how to migrate, see: $kMigrateToBuiltInKotlinDocsUrl''', title: _boxTitle);
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

For consistency with other error handlers in this file (like useNewAgpDslErrorHandler), please include the file path where the error occurred and adjust the spacing to group the resolution steps together. This aligns with the principle that error messages should be useful and consistent.

References
  1. Error messages should be useful: Every error message is an opportunity to make someone love our product. (link)

\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

Add a comma after 'this' and capitalize 'Flutter' for better readability and correctness. This ensures the error message is professional and clear.

References
  1. Error messages should be useful: Every error message is an opportunity to make someone love our product. (link)

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.

medium

There is an extra leading space in this string which will cause the test to fail, as the source code does not have a space before 'This' (it follows a newline in a multiline string).

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 updates AGP 9 migration error messages in the Flutter tools by replacing a generic warning constant with specific documentation URLs for built-in Kotlin migration and new DSL opt-out. The review feedback suggests restoring the Gradle file path in the Kotlin plugin error message to maintain consistency and provide better context for developers. Additionally, there are suggestions to correct capitalization and punctuation in the DSL error message and to fix a leading space in a test expectation that would otherwise cause a test failure.

Comment on lines +686 to +690
globals.printBox('''
${globals.logger.terminal.warningMark} Starting AGP 9+, the default has become built-in Kotlin.
This results in a build failure when applying the kotlin-android plugin.
To resolve this, migrate to built-in Kotlin.
\nFor instructions on how to migrate, see: $kMigrateToBuiltInKotlinDocsUrl''', title: _boxTitle);
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 updated error message removes the path to the Gradle file where the failure occurred. Including the file path (appGradleFile.path) is helpful for developers to identify where the change is needed, and it maintains consistency with the error message in useNewAgpDslErrorHandler (line 712).

Suggested change
globals.printBox('''
${globals.logger.terminal.warningMark} Starting AGP 9+, the default has become built-in Kotlin.
This results in a build failure when applying the kotlin-android plugin.
To resolve this, migrate to built-in Kotlin.
\nFor instructions on how to migrate, see: $kMigrateToBuiltInKotlinDocsUrl''', title: _boxTitle);
final File appGradleFile = project.android.appGradleFile;
globals.printBox('''
${globals.logger.terminal.warningMark} Starting AGP 9+, the default has become built-in Kotlin.
This results in a build failure when applying the kotlin-android plugin at ${appGradleFile.path}.
To resolve this, migrate to built-in Kotlin.
\nFor instructions on how to migrate, see: $kMigrateToBuiltInKotlinDocsUrl''', title: _boxTitle);
References
  1. Error messages should be useful: Every error message is an opportunity to make someone love our product. (link)

\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 "To resolve this" and "Flutter" should be capitalized for consistency with other error messages in the tool.

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)

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.

medium

This expectation contains an unexpected leading space (' This results...'), which is inconsistent with the code on line 688 of gradle_errors.dart and with the other test case on line 1701. This will likely 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'),

@jesswrd
Copy link
Copy Markdown
Contributor Author

jesswrd commented Apr 14, 2026

"Developers should not be running into this error at all due to . " Due to what?

done added link.

@jesswrd jesswrd added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 14, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Apr 14, 2026
Merged via the queue into flutter:master with commit 85d5706 Apr 15, 2026
158 of 159 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 15, 2026
master-wayne7 pushed a commit to master-wayne7/flutter that referenced this pull request Apr 15, 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
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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD 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.

2 participants