Posted by Anthony Morris, SWE Google Play
Google Play continues to grow rapidly, as Android users installed over 65 billion apps in the last year from the Google Play Store. We’re also seeing developers move to update their apps more frequently to push great new content, patch security vulnerabilities, and iterate quickly on user feedback.
However, many users are sensitive to the amount of data they use, especially if they are not on Wi-Fi. Google Play is investing in improvements to reduce the data that needs to be transferred for app installs and updates, while making data cost more transparent to users.
Read on to understand the updates and learn some tips for ways to optimize the size of your APK.
New Delta algorithm to reduce the size of app updates
For approximately 98% of app updates from the Play Store, only changes (deltas) to APK files are downloaded and merged with the existing files, reducing the size of updates. We recently rolled out a delta algorithm, bsdiff, that further reduces patches by up to 50% or more compared to the previous algorithm. Bsdiff is specifically targeted to produce more efficient deltas of native libraries by taking advantage of the specific ways in which compiled native code changes between versions. To be most effective, native libraries should be stored uncompressed (compression interferes with delta algorithms).
An example from Chrome:
|Patch Description||Previous patch size||Bsdiff Size|
|M46 to M47 major update||22.8 MB||12.9 MB|
|M47 minor update||15.3 MB||3.6 MB|
Apps that don’t have uncompressed native libraries can see a 5% decrease in size on average, compared to the previous delta algorithm.
Applying the delta algorithm to APK Expansion Files to further reduce update size
APK Expansion Files allow you to include additional large files up to 2GB in size (e.g. high resolution graphics or media files) with your app, which is especially popular with games. We have recently expanded our delta and compression algorithms to apply to these APK Expansion Files in addition to APKs, reducing the download size of initial installs by 12%, and updates by 65% on average.
Clearer size information in the Play Store
Alongside the improvements to reduce download size, we also made information displayed about data used and download sizes in the Play Store clearer. You can now see actual download sizes, not the APK file size, in the Play Store. If you already have an app, you will only see the update size. These changes are rolling out now.
Tips to reduce your download sizes
1. Optimize for the right size measurements: Users care about download size (i.e. how many bytes are transferred when installing/updating an app), and they care about disk size (i.e. how much space the app takes up on disk). It’s important to note that neither of these are the same as the original APK file size nor necessarily correlated.
|Compressed Native Library||Uncompressed Native Library|
|APK Size||39MB||52MB (+25%)|
|Download size (install)||29MB||29MB (no change)|
|Download size (update)||29MB||21MB (-29%)|
|Disk size||71MB||52MB (-26%)|
Chrome found that initial download size remained the same by not compressing the native library in their APK, while the APK size increased, because Google Play already performs compression for downloads. They also found that the update size decreased, as deltas are more effective with uncompressed files, and disk size decreased as you no longer need an compressed copy of the native library:
2. Reduce your APK size: Remove unnecessary data from the APK like unused resources and code.
3. Optimize parts of your APK to make them smaller: Using more efficient file formats, for example by using WebP instead of JPEG, or by using Proguard to remove unused code.