-
Notifications
You must be signed in to change notification settings - Fork 28.8k
Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 #171399
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
base: master
Are you sure you want to change the base?
Conversation
|
||
@VisibleForTesting internal val errorGradleVersion: Version = Version(7, 0, 2) | ||
@VisibleForTesting internal val errorGradleVersion: Version = Version(8, 0, 0) |
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.
if I may, in order to unlock filePermissions API (to resolve this), this version should be at least 8.3, because filePermission API was introduced there and it's recommended replacement for fileMode
.
Another way - is to use some reflection to invoke either API based on gradle version, but this is error-prone and I believe it should not be the preferred way to solve it. And not 100% sure it's possible in this case :)
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.
Also, about gradle versions – Android studio (at least stable version) is shipped with JDK 21 on board, and flutter prefers to use studio's jdk. The thing here is running gradle on java 21 is officially supported from gradle 8.5, in prior versions there'll be not-so-obvious errors (I remember many questions on SO when android studio with java 21 onboard first released)
Im not sure, but maybe this "strange" relationship should also be somehow reflected in this version range ?
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 bumped the minimum gradle version to 8.3.
Java version is determined at the machine level in our ci for most suites of tests.
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.
Just to clarify - my point about about 8.5 was mainly from user perspective: android studios bundled jdk is most used for flutter (because the majority of developers do not override it in config, at least that's what I saw) and this jdk requires 8.5 because it is first version which supports running on jdk 21.
This might be frustrating for newcomers, but now I think it's mitigated by the fact that fresh projects use more recent version of gradle from project template
Anyway, I think current version here is ok.
|
||
@VisibleForTesting internal val errorAGPVersion: AndroidPluginVersion = AndroidPluginVersion(7, 0, 0) | ||
@VisibleForTesting internal val errorAGPVersion: AndroidPluginVersion = AndroidPluginVersion(8, 1, 0) |
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.
Maybe it'll be better to use 8.1.1
here? Per Compatibility matrix this version is last supported now for Google Play publishing (android api level should be at least 34 till August 31 2025 -> api level 34 requires at least AGP 8.1.1).
I'm using the kinda-"flutter should support AGP which is suitable for Google play publishing" here, do not know if it should be this way though. But do not see downsides in this approach :)
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.
done
@@ -0,0 +1,7 @@ | |||
distributionBase=GRADLE_USER_HOME |
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.
Hmm shouldn't this file be gitignored based on the entry above? It is within packages/flutter_tools/gradle/.gitignore
and has path starting in gradle
?
Also I don't think it should be added, should 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 had to add it with force. Right now what we develop with is different across engineers based on when they ran the wrapper script. That said this change should be talked about and not part of a min version bump. Will remove.
|
||
@VisibleForTesting internal val errorAGPVersion: AndroidPluginVersion = AndroidPluginVersion(7, 0, 0) | ||
@VisibleForTesting internal val errorAGPVersion: AndroidPluginVersion = AndroidPluginVersion(8, 1, 1) |
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 personally would prefer that we bump our Error(AGP) here to 8.3, the value which we have been warning for. This allows us also to bump our Error(Gradle) version to 8.4, as based on https://developer.android.com/build/releases/past-releases/agp-8-3-0-release-notes that is the minimum required.
In the most technical sense it still breaks our policy, and in the future I think we probably should satisfy at all times Warn(Gradle) >= RequiredGradleFor(Warn(AGP))
. But because it is required it isn't a meaningful break of the policy, imo. And every other change falls within the policy.
This is a mild preference though and, I admit, at least partially motivated by being able to say we stayed within our policy.
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.
We talked about this out of band. I think that giving users a clear error is prefered to technically following our policy and letting users discover that the versions they need are higher than what we enforce. In the future we agree that the Warn(Gradle) >= RequiredGradleFor(Warn(AGP)
that is a good policy to have.
packages/flutter_tools/gradle/src/main/kotlin/DependencyVersionChecker.kt
Show resolved
Hide resolved
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.
Bumping our error Gradle version without a release of warning for that Gradle version is unfortunate, but required for supporting Gradle 9, so LGTM.
At least we have been warning about AGP<8.3 for a while, so implicitly we have sort of been warning for Gradle<8.4 (as AGP 8.3 requires Gradle 8.4 🙂 )
https://gradle.org/whats-new/gradle-9/ is coming and with it includes some deprecated methods. Some like #171397 can be fixed by annotations and calling new methods. Some like the deprecation of minsdkversion on Variant require bumping the minimum versions to be able to compile code that will work.
b/368604254
Pre-launch Checklist
///
).