Skip to content

[Gradle 9] Removed minSdkVersion and only use minSdk #173892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jesswrd
Copy link
Contributor

@jesswrd jesswrd commented Aug 16, 2025

Support for minSdkVersion is completely dropped in Gradle 9, and we should only use minSdk. We also included an AGP version checker to ensure builds did not crash when getting the minimum sdk version. Since our minimum AGP version is now 8.3, we can remove agp version check.

Pre-launch 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.

@jesswrd jesswrd requested a review from a team as a code owner August 16, 2025 03:41
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Aug 16, 2025
Copy link
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 correctly removes the usage of the deprecated minSdkVersion property in favor of minSdk, which is necessary for Gradle 9 support. The changes simplify the logic by removing the Android Gradle Plugin (AGP) version check, as the minimum supported AGP version now guarantees the availability of minSdk.

My review includes suggestions to improve naming consistency in the changed code, aligning function and variable names with the minSdk property to enhance readability and maintainability. The changes are otherwise correct and well-justified.

@@ -155,7 +155,7 @@ object DependencyVersionChecker {
val minSdkCheckTask =
project.tasks.register(taskName) {
doLast {
val minSdkVersion = getMinSdkVersion(project, it)
val minSdkVersion = getMinSdkVersion(it)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To align with the proposed rename of getMinSdkVersion and the PR's intent, let's update the call here and rename the local variable. For full consistency, you might consider renaming the MinSdkVersion class and checkMinSdkVersion function in a follow-up, as their definitions are outside this PR's scope.

Suggested change
val minSdkVersion = getMinSdkVersion(it)
val minSdk = getMinSdk(it)

@@ -181,19 +181,8 @@ object DependencyVersionChecker {
private fun generateMinSdkCheckTaskName(it: Variant) = "${FlutterPluginUtils.capitalize(it.name)}$MIN_SDK_CHECK_TASK_POSTFIX"

private fun getMinSdkVersion(
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Since this PR's goal is to use minSdk instead of minSdkVersion, consider renaming this function to getMinSdk for better clarity and consistency. The call site at line 158 will also need to be updated.

Suggested change
private fun getMinSdkVersion(
private fun getMinSdk(

Copy link
Contributor

Choose a reason for hiding this comment

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

@jesswrd I disagree here.

@jesswrd jesswrd requested a review from reidbaker August 16, 2025 03:56
MinSdkVersion(it.name, it.minSdkVersion.apiLevel)
}
}
): MinSdkVersion = MinSdkVersion(it.name, it.minSdk.apiLevel)
Copy link
Contributor

Choose a reason for hiding this comment

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

@gmackall what are your thoughts on removing this method and inlining the implementation vs just modifying the implementation like is done here.

@reidbaker reidbaker requested a review from gmackall August 18, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-android Android applications specifically 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