Estimates the size of a Google Play patch and the new gzipped APK.
From two APKs it estimates the size of the new patch as well as the size of the gzipped version of the new APK, which would be used in cases where the patch is 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 and bsdiff (bsdiff is the only binary used not installed by defult in a unix based OS or Cygwin)
$ python apk_patch_size_estimator.py --old-file old.apk --new-file new.apk
Estimates:
New APK size on Disk: 6861218 bytes [6.54MB]
New APK Gzipped size (== Download size for new installs): 6863020 bytes [6.55MB]
Gzipped Bsdiff Patch Size (== Download size for updates from the old APK): 2228544 bytes [2.13MB]
The script uses bsdiff, gzip, head, tail and bunzip2 binaries, bsdiff is the only one not installed by defult in a unix based OS.
Install bsdiff:
sudo apt-get install bsdiff
Install bsdiff using Homebrew:
brew install bsdiff
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.
pip install mock
python -m unittest discover tests/
Julian Toledo
Andrew Hayden