Issue
I have a project that includes a couple of cpu architecture specific .so files - the biggest being the xwalk lib, which is 60MB for the v8a version and 37MB for the v7a version.
When we had split APK the arm-v7a app apk version would be around 38mb and the arm-v8a apk would be around 41mb, which makes sense - zipping the lib would result in 23MB and 20MB, respectively.
When using app bundles it seems that the generated APKs are not compressed at all. the 60MB and 37MB are added to the apk size almost unchanged, resulting in a 97MB apk for 64bit arm devices.
I get consistent result when using the bundletool to generate the apks for one specific device and when downloading from the internal app testing play store site which returns the apks also depending on the device.
Am I missng something here or are app bundles not the best option when containing .so files and one is better off using split APKs again?
Solution
What matters is not the file size of the APK, but the download size of your app and the size on device of your app.
When you build an App Bundle, by default Play will leave the native libraries (.so) uncompressed in the generated APKs. Although this leads to a bigger APK file, this results in:
- Smaller downloads for users because the compression over-the-wire can be more efficient,
- Smaller app size on the device because the Android platform can mmap the .so files directly into memory without having to extract them first into a directory (thus saving a copy of the uncompressed .so file on disk).
bundletool actually provides a command get-size which estimates the download size for you. In practice, this the size is often even smaller when better compression algorithms can be applied, but this is a best effort by Play.
Here's a video from Google I/O 2019 where they explain the difference between the different types of size you can measure (at 15:55), and what Play does to help reduce the size of apps.
Hope that helps,
Answered By - Pierre
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.