APK patch size estimator
Estimates the size of Google Play patches and the new gzipped APK.
From two APKs it estimates the size of the new patches as well as the size of the gzipped version of the new APK, which would be used in cases where the patches are unexpectedly large, unavailable, or unsuitable. Google Play uses multiple techniques to generate patches and generally picks the best match for the device. The best match is usually, but not always, the smallest patch file produced. The numbers that this script produces are ESTIMATES that can be used to characterize the impact of arbitrary changes to APKs. There is NO GUARANTEE that this tool produces the same patches or patch sizes that Google Play generates, stores or transmits, and the actual implementation within Google Play may change at any time, without notice.
This is not an official Google product
The script uses Python 2.7.X, bsdiff and Java (you may need to install them in your system)
For the file-by-file estimation we use a jar (at /lib/file-by-file-tools.jar) generated from: https://github.com/andrewhayden/archive-patcher
To estimate the patches sizes of two APKs run:
$ python apk_patch_size_estimator.py --old-file old.apk --new-file new.apk
None GZIP BROTLI None 6.54MB 6.54MB 6.54MB BSDIFF 6.54MB 2.12MB 2.12MB File-By-File 6.54MB 2.12MB 2.12MB
Patches estimation process
Please visit https://github.com/google/archive-patcher for further details.
Installing external dependencies
sudo apt-get install bsdiff brotli
Install bsdiff using Homebrew:
brew install bsdiff brotli
The easiest way to run the script in Windows is by using Cygwin, make sure you install python and bsdiff using Cygwin's installer/setup.
Runing the unittests
pip install mock
Run the test
python -m unittest discover tests/
Julian Toledo Andrew Hayden Song Pan