-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[android][tool] Consolidate minimum versions for android projects. #171965
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
[android][tool] Consolidate minimum versions for android projects. #171965
Conversation
| - The flutter min version in `engine/src/flutter/shell/platform/android/io/flutter/Build.java` | ||
| - The versions used when engine testing in `engine/src/flutter/shell/platform/android/test_runner/build.gradle` | ||
| - The versions used when working in engine/shell in `engine/src/flutter/shell/platform/android/build.gradle` | ||
| - The minSdkVersion used in `packages/flutter_tools/lib/src/android/android.dart` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean in the packages/flutter_tools/lib/src/android folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to this file reverted. I tried to exclude them.
mboetger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - minor nit
| String? sdkVersionText; | ||
| final AndroidSdkVersion? androidSdkLatestVersion = androidSdk.latestVersion; | ||
| if (androidSdkLatestVersion != null) { | ||
| if (androidSdkLatestVersion.sdkLevel < kAndroidSdkMinVersion || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is doing something slightly different than checking the minSdk, right? Our min supported minSdk is 24, but this seems to be checking "what is the min version among sdk installations", which is a different value and I assume also why this is being checked against a significantly higher value. Perhaps @bkonyi knows why we have a restriction on the min installed sdk version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make sense and if so will cause me to modify this pr. Holding on a response from @bkonyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I'm not sure myself. Can we look at the history of packages/flutter_tools/lib/src/android/android.dart and kAndroidSdkMinVersion in this file to try and figure out if there's a particular reason that they're different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some code spelunking. Looks like past flutter teams might have mixed the use of compileSdk and targetSdk but some of code was in place to set a minimum compile sdk version, some other of this code was for minimum build tool version.
#54382
#63517
a2e5e07#diff-c245d623bd123a206f90dc458d73520304e81ff8d1eac06a38e2c5221a859bfa
It also appears that the last time this value was updated was 2020. My choices now are to remove this code, update it to a higher min compile sdk version or to do nothing to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I am going to move the minimums to be together. Reread the exising code to confirm that the way we enforce compile time and minimum versions are what we want and leave the build tool enforcement alone.
| }); | ||
|
|
||
| testWithoutContext('Can install app on API level 16 or greater', () async { | ||
| testWithoutContext('Can install app on API level minSdk or greater', () async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe include the minSdk value here in the test name?
Something like:
Can install app on API level ${gradle_utils.minSdkVersion} or greater
or:
Can install app on API level minSdk (${gradle_utils.minSdkVersion}) or greater
| String? sdkVersionText; | ||
| final AndroidSdkVersion? androidSdkLatestVersion = androidSdk.latestVersion; | ||
| if (androidSdkLatestVersion != null) { | ||
| if (androidSdkLatestVersion.sdkLevel < kAndroidSdkMinVersion || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I'm not sure myself. Can we look at the history of packages/flutter_tools/lib/src/android/android.dart and kAndroidSdkMinVersion in this file to try and figure out if there's a particular reason that they're different?
mboetger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
flutter/flutter@9de63a0...92a6bfb 2025-08-07 [email protected] Roll Packages from f0b2726 to 6efb759 (4 revisions) (flutter/flutter#173414) 2025-08-07 [email protected] Provide monitor list, display size, refresh rate, and more for Windows (flutter/flutter#164460) 2025-08-07 [email protected] [android][tool] Consolidate minimum versions for android projects. (flutter/flutter#171965) 2025-08-07 [email protected] Roll Fuchsia Linux SDK from 2Mo76-tiDj4ZCZbPv... to i4vsuEGyP8Xeb5tiy... (flutter/flutter#173409) 2025-08-07 [email protected] Roll Skia from 9a886bdfb716 to a6ccfeafbfba (1 revision) (flutter/flutter#173384) 2025-08-07 [email protected] Fix drawerScrimColor transition. (flutter/flutter#173280) 2025-08-07 [email protected] Roll Skia from dd60ed46a006 to 9a886bdfb716 (2 revisions) (flutter/flutter#173382) 2025-08-06 [email protected] Roll Skia from 05d82af3f4bd to dd60ed46a006 (2 revisions) (flutter/flutter#173376) 2025-08-06 [email protected] Roll Skia from 5518bb27db67 to 05d82af3f4bd (2 revisions) (flutter/flutter#173372) 2025-08-06 [email protected] Roll Skia from 9bb1fc4bc326 to 5518bb27db67 (2 revisions) (flutter/flutter#173363) 2025-08-06 [email protected] Roll Skia from a918c0e08500 to 9bb1fc4bc326 (24 revisions) (flutter/flutter#173355) 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 Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: 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
…lutter#171965) I discovered we had a duplicate entry for what the min sdk api level flutter supports along with duplicate code for telling the user. This pr keeps the duplicate warnings but removed duplicate definitions. Updates the related tests Updates workflow_test and android_workflow to compare against the compile sdk version since the validation was ensuring that the lastest of the installed sdks was at least what was needed for flutter to compile. This make this pr more than a formatting/refactoring change and an actual user facing change. Requesting re-review. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [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]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] 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. - [x] All existing and new tests are passing.
…lutter#171965) I discovered we had a duplicate entry for what the min sdk api level flutter supports along with duplicate code for telling the user. This pr keeps the duplicate warnings but removed duplicate definitions. Updates the related tests Updates workflow_test and android_workflow to compare against the compile sdk version since the validation was ensuring that the lastest of the installed sdks was at least what was needed for flutter to compile. This make this pr more than a formatting/refactoring change and an actual user facing change. Requesting re-review. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [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]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] 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. - [x] All existing and new tests are passing.
…lutter#171965) I discovered we had a duplicate entry for what the min sdk api level flutter supports along with duplicate code for telling the user. This pr keeps the duplicate warnings but removed duplicate definitions. Updates the related tests Updates workflow_test and android_workflow to compare against the compile sdk version since the validation was ensuring that the lastest of the installed sdks was at least what was needed for flutter to compile. This make this pr more than a formatting/refactoring change and an actual user facing change. Requesting re-review. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [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]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] 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. - [x] All existing and new tests are passing.
…lutter#171965) I discovered we had a duplicate entry for what the min sdk api level flutter supports along with duplicate code for telling the user. This pr keeps the duplicate warnings but removed duplicate definitions. Updates the related tests Updates workflow_test and android_workflow to compare against the compile sdk version since the validation was ensuring that the lastest of the installed sdks was at least what was needed for flutter to compile. This make this pr more than a formatting/refactoring change and an actual user facing change. Requesting re-review. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [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]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] 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. - [x] All existing and new tests are passing.
…lutter#171965) I discovered we had a duplicate entry for what the min sdk api level flutter supports along with duplicate code for telling the user. This pr keeps the duplicate warnings but removed duplicate definitions. Updates the related tests Updates workflow_test and android_workflow to compare against the compile sdk version since the validation was ensuring that the lastest of the installed sdks was at least what was needed for flutter to compile. This make this pr more than a formatting/refactoring change and an actual user facing change. Requesting re-review. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [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]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] 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. - [x] All existing and new tests are passing.
I discovered we had a duplicate entry for what the min sdk api level flutter supports along with duplicate code for telling the user.
This pr keeps the duplicate warnings but removed duplicate definitions.
Updates the related tests
Updates workflow_test and android_workflow to compare against the compile sdk version since the validation was ensuring that the lastest of the installed sdks was at least what was needed for flutter to compile. This make this pr more than a formatting/refactoring change and an actual user facing change. Requesting re-review.
Pre-launch Checklist
///).