-
-
Notifications
You must be signed in to change notification settings - Fork 663
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 build: Split up APKs per ABI #5296
Conversation
This bit of code doesn't currently do anything, because we build a single APK for all devices. It would if we started building split APKs per ABI. This sort of thing was required for publishing an app as multiple APKs on Google Play. (The docs link in the comment is broken; a current version appears to be: https://developer.android.com/google/play/publishing/multiple-apks#VersionCodes .) Google Play would use the different version codes as tiebreakers to decide which APK to give to a device when several were supported. But on Google Play, publishing multiple APKs has been obsolete for years. Instead, one uploads a single AAB, "Android App Bundle", and then Google slices and dices that into separate APKs for the per-ABI files, the per-screen-density files, the per-screen-size files, and so on. Each device downloads the specific combination of those pieces that applies to it. We never did publish multiple APKs on Google Play, and because it's now obsolete we never will; we've been using AABs since zulip#3547 in 2020. We do intend to start publishing multiple APKs, which would cause this bit of code to start having an effect. But this convention doesn't seem to be useful anywhere else: for a user installing directly from our GitHub release it's invisible and unhelpful, and the one known downstream distributor of our APKs plans to just distribute the one most widely-supported of them anyway: zulip#1270 (comment) which will make this hack have no use there either. So it seems like messing with the version codes like this would only cause confusion. Instead, just let the different per-ABI APKs for a given release have the same version code as each other, and as the AAB does. That way the next release after v27.181 will have version code simply 182, rather than 182003 et al.
The great bulk of the size of our APK comes from the native libraries in it (most of all libjsc.so). Those exist in a separate copy for each of our 4 ABIs, but any given device is going to use only one of those. So, build a separate APK for each ABI. The new APK for armeabi-v7a (the most widely-supported) is 35.1MB, compared to 132.3MB for the old all-in-one APK. This has no effect for the many Android users who get our app via the Google Play Store: there, we already upload an AAB, which Google splits up into several APKs still more finely. See zulip#3547. Fixes: zulip#5295
Thanks! Merged. |
Thanks a lot! For clarification: does his mean the next release will have per-ABI builds attached, and one of them will carry the string Another question goes towards |
Yep, that's right. Here's what the APKs look like, with sizes, in a test build after this change:
(That wasn't quite a realistic simulation of a release -- I signed them with my development key, rather than the distribution key used for releases. But should be very close.)
Hmm, I see. We actually had some code along those lines -- inherited from the React Native template app, where it originates with facebook/react-native@abb81eb27 from 2016 -- but as you see I took it out in this PR (in 0107348 ) because I thought it was mainly useful on Google Play, and it seems like it makes things more complicated. So at the current version after this PR, the It's interesting that Flutter does a similar thing. Do you perhaps have a link where I can read more about what Flutter does? In any case I think it should be fine if we make our next release with everything at simply 182, and then switch to a more complicated scheme in the next release or the next. The more complicated schemes will all have larger version codes, so it's easy to switch in that direction -- hard to do the reverse. |
Hmm, so, I believe if you have an app installed with a given In particular, when doing development, I'll regularly be making small changes and then installing a new version of the app, and leaving the That means that if you're going to have the 32-bit and 64-bit versions have different version codes, it's important that the one for 64-bit be higher instead of lower, but it's fine for them to be the same. Where it is useful for them to be different is if you've just upgraded the device and you're looking in an automated way to find which apps you can upgrade: you just check for any app you have where there's an installable APK with a higher version code than you have. It means that your app store/repository, or your browser for it, does need to understand how to filter which APKs are installable for your device, but doesn't need to understand anything about how to choose between several that are installable. Similarly when you're installing the app for the first time. Based on that old Android docs page https://developer.android.com/google/play/publishing/multiple-apks , that design is apparently exactly how Google Play worked, back before they started doing AABs instead. But that won't be relevant for people using your repository, as I understand it -- you're planning to publish just the It also isn't relevant for people installing the app directly from our GitHub releases -- one doesn't even see the Perhaps in the future it could be useful for people on F-Droid? Wouldn't be surprising if F-Droid works the same way as Google Play used to in this respect. |
Thanks! I've just set this in your app's YAML config here, in preparation for the next release.
Perfect, that way users can even update the other way around when e.g. switching devices.
Afraid not – I can just tell from what I see with other projects. I never read any Flutter docs TBH. But what I can do is give you a link to my notes.
I fully agree with the first part. The second part would just be needed if a repository would want to host more then one ABI build (as
Ack to that paragraph with a minor deviation: no update notifications, so you'd need to trigger that manually. But well, in case of updating to a related ABI, you'd do that manually anyway.
Yupp, exactly. Same for the paragraph following that one 😄 In such a case, e.g. the F-Droid client would offer you to install the arm64 of the same version if you came from armeabi, as it has a higher VC and matches your arch.
I can confirm that, yes 😄
Point, match and victory – that was exactly what I had in mind 🤩 One day, Zulip might be listed there – and thanks to the work we did here, everything would be prepared well 🥳 Did I mention I'm one of the F-Droid maintainers as well? 🤔 🙈 |
Sounds good! We've now tagged a 182 release and have a build running in alpha -- meaning a handful of us update our own devices to it. It should be out in beta very soon -- meaning it'll be a GitHub release marked "pre-release". Then probably next week we'll roll it out to production, so marking that GitHub release as no longer a pre-release.
Cool, that sounds like a good plan.
Ah, yeah -- that paragraph was meant to only describe the behavior of the Android system itself, not any distribution channels. Android itself pays attention to the
Cool 😄 Thanks for all your help with this! |
Ah, good. Just to let you know: my updater is currently set to ignore pre-releases altogether – and as I've just noticed you name the tags
Yes, so we're having the same things in mind – matches perfectly what I meant.
Gladly done! If there are any questions you need help with concerning F-Droid (or my repo, etc), just ring my bell – I try to help if I can (i.e. if time permits – to many pots on the stove 🙈) |
The old link here broke once we introduced separate APKs per ABI, in zulip/zulip-mobile#5296. We could make a direct link to app-armeabi-v7a-release.apk , the one that's compatible with almost all devices. But perhaps better is to just go back to linking to the release page, where the user can choose the best APK for their device. (If they're in the habit of downloading APKs manually to install on their device, then probably that means they're going to be used to choosing the right one.) User report and discussion: https://chat.zulip.org/#narrow/stream/48-mobile/topic/Direct.20apk.20download.20link.20is.20404/near/1358758
The old link here broke once we introduced separate APKs per ABI, in zulip/zulip-mobile#5296. We could make a direct link to app-armeabi-v7a-release.apk , the one that's compatible with almost all devices. But perhaps better is to just go back to linking to the release page, where the user can choose the best APK for their device. (If they're in the habit of downloading APKs manually to install on their device, then probably that means they're going to be used to choosing the right one.) User report and discussion: https://chat.zulip.org/#narrow/stream/48-mobile/topic/Direct.20apk.20download.20link.20is.20404/near/1358758
The great bulk of the size of our APK comes from the native
libraries in it (most of all libjsc.so). Those exist in a
separate copy for each of our 4 ABIs, but any given device
is going to use only one of those.
So, build a separate APK for each ABI. The new APK for armeabi-v7a
(the most widely-supported) is 35.1MB, compared to 132.3MB for the
old all-in-one APK.
This has no effect for the many Android users who get our app via
the Google Play Store: there, we already upload an AAB, which
Google splits up into several APKs still more finely. See #3547.
Fixes: #5295
/cc @IzzySoft