-
Notifications
You must be signed in to change notification settings - Fork 177
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
deps android: Upgrade Android Gradle Plugin #887
Conversation
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.
Thanks for taking care of this!
I read through all the linked release notes (well, skimming over the parts that seem irrelevant to us like Kotlin/Native), and these all make sense to me. I took some additional notes for a couple of the commits, which I'll push as a revision.
It looks like I'll have to upgrade my Android Studio before I can test this locally (I'm currently on Hedgehog). Is the last commit, the AGP upgrade, the one that fixes #879? Let's mention that in the commit message.
android/app/build.gradle
Outdated
|
||
compileOptions { | ||
coreLibraryDesugaringEnabled true |
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.
android build: Enable core library desugaring for
flutter_local_notifications
commit-message nit: summary on one line
Though separately, this reads to me like it's saying it's enabling that option only to apply to that library — that's what "enable foo for bar" normally means to me. Could replace " for" by ", needed by"… or even just by ", for".
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.
oh and separate nit:
This applies the Android setup steps required for
package:flutter_local_notification [1], enabling core library
the package's name is plural
android/gradle.properties
Outdated
agpVersion=8.1.4 | ||
agpVersion=8.5.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.
Ah I see, we hadn't been neglecting these upgrades so much as I thought at #879 (comment) — I just wasn't looking at the right file's history. 🙂 That makes more sense.
@@ -23,9 +23,9 @@ android { | |||
namespace "com.zulip.flutter" | |||
|
|||
compileSdkVersion flutter.compileSdkVersion | |||
ndkVersion flutter.ndkVersion |
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.
android build: Avoid specifying ndkVersion explicitly
This commit message needs a bit more explanation, so that our future selves and/or successors reading this a couple of years from now when the question of the NDK version comes up again don't have to wonder what we were thinking or sleuth it out.
I'll write a version. → 2e59090
0a0019e
to
4ccdb93
Compare
Thanks for the review @gnprice, pushed a new revision PTAL. |
android/gradle.properties
Outdated
@@ -6,11 +6,11 @@ android.enableJetifier=true | |||
# Defining them here makes them available both in | |||
# settings.gradle and in the build.gradle files. | |||
|
|||
agpVersion=8.1.4 | |||
agpVersion=8.5.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.
Is there a reason to go for 8.5.0 instead of 8.5.2? It looks like that's the latest.
(My usual approach would be to go for the latest patch release within a given minor release, even when holding back at an older minor or major release for whatever reason.)
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.
Is there a reason to go for 8.5.0 instead of 8.5.2?
Not really, hadn't realized there was a newer one, I just took that version from release notes.
Updated now to 8.5.2.
OK, I upgraded my Android Studio so I could build this, and confirmed that it fixes #879 (and that I can reproduce that before this PR). I'm seeing also this warning on
Not catastrophic if we have to live with those warnings for a bit, but it is somewhat annoying. Would you spend a bit of time investigating that and trying to find a fix? |
Also confirmed that #879 reproduces just before the last commit, so it is that commit (the AGP upgrade) that fixes it. (As a side effect I learned that that next-to-last commit already has the warning above, so whatever introduces that comes before the last commit.) |
I only got that after a |
4ccdb93
to
13b451e
Compare
Thanks for the review @gnprice, pushed a new revision, PTAL. |
Release notes: https://docs.gradle.org/8.7/release-notes.html https://docs.gradle.org/8.8/release-notes.html https://docs.gradle.org/8.9/release-notes.html Some highlights: * 8.7 "Support for building projects with Java 22" * 8.8 "Full Java 22 support" * 8.9 "Error and warning reporting improvements" [greg: One other notable theme in the 8.7 and 8.8 release notes is caching improvements. Hopefully our builds might get faster.]
Release notes: https://kotlinlang.org/docs/whatsnew1920.html https://kotlinlang.org/docs/whatsnew20.html Highlights: * 1.9.20 - Standard library; Improvements to the Atomics API. - Otherwise mostly related to Wasm, Native and Kotlin Multiplatform. * 2.0.0 - Enables the new unified K2 compiler by default on all targets. - Language; Smarter type-casting - - JVM; better bytecode for lambda enabled by default, which reduces the binary size. - Standard Library; AutoCloseable interface - Many more to list here.
Yeah, that seems to be how warnings in Android builds often behave. It can be annoying when trying to debug and eliminate the warnings, because it makes it tricky to confidently reproduce them… but it does also mitigate the impact of the warning noise somewhat.
Cool, thanks for tracking that down. I upvoted the issue and subscribed. Looks like it's been there a year, which is less promising than if it were just recently filed; but it also lacks a repro, so after merging this I'll comment there offering zulip-flutter as a repro, and potentially that'll help get it fixed. That also means the |
…l_notifications This applies an Android setup step called for by package:flutter_local_notifications: https://github.com/MaikuB/flutter_local_notifications/tree/d565daab613052fecaf723df865101b46ee5a26a/flutter_local_notifications#gradle-setup namely enabling core-library desugaring: https://developer.android.com/studio/write/java8-support#library-desugaring We seem to have been fine without that step so far. But after the upcoming upgrade to AGP 8.5.2 (from 8.1.4), the build starts giving an error demanding this change: Execution failed for task ':app:checkReleaseAarMetadata'. > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction > An issue was found when checking AAR metadata: 1. Dependency ':flutter_local_notifications' requires core library desugaring to be enabled for :app. See https://developer.android.com/studio/write/java8-support.html for more details. [greg: expanded commit message, added comment]
Specifying the NDK version here doesn't seem to do us any good. This value provided by the `flutter` tool is currently 23.1.7779620. If we upgrade the Android Gradle plugin (AGP) to 8.5.2, its current latest, then we start getting build warnings: zulip#879 (comment) saying that a bunch of plugins -- including first-party plugins -- are all using NDK 26.1.10909125 instead, and telling us to switch to that. Conversely, if we leave this line out, then the same AGP upgrade causes no warnings and works just fine. So let the version float. This does contradict AGP's own recommendation: https://developer.android.com/studio/projects/configure-agp-ndk which is to use this `ndkVersion` property. But if a bunch of our plugins are going to use a floating version anyway, it doesn't seem helpful to try to hang back. [greg: added commit-message body]
Release notes: https://developer.android.com/build/releases/past-releases/agp-8-2-0-release-notes https://developer.android.com/build/releases/past-releases/agp-8-3-0-release-notes https://developer.android.com/build/releases/past-releases/agp-8-4-0-release-notes https://developer.android.com/build/releases/gradle-plugin (for 8.5, for now) Some of the release notes (especially 8.2) are very thin; it's not clear if there are other changes that aren't being described, or if they just didn't change much. Changes possibly affecting us: * 8.3 adds "precise resource shrinking", which seems to be an additional form of resource shrinking. * As usual, a new AGP version requires a new Android Studio version. AGP 8.5 requires Android Studio Koala. [greg: added reading of release notes] Fixes: zulip#879
Following up on this: my comment prompted that thread to get closed as a duplicate, and it turns out that the bug had been fixed (in that library's main branch) just a couple of days earlier: So eventually that'll filter into AGP, and then into an AGP release that we upgrade to. Meanwhile we're about to complete #351 removing |
Fixes: #879