| OLD | NEW |
| (Empty) | |
| 1 # APK patch size estimator |
| 2 Estimates the size of Google Play patches and the new gzipped APK. |
| 3 |
| 4 From two APKs it estimates the size of the new patches as well as the size of th
e gzipped version of the new APK, which would be used in |
| 5 cases where the patches are unexpectedly large, unavailable, or unsuitable. |
| 6 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 small
est 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 tha
t Google Play generates, stores or transmits, and the actual implementation with
in Google Play may change at any time, without notice. |
| 7 |
| 8 ***This is not an official Google product*** |
| 9 |
| 10 ## Usage |
| 11 |
| 12 The script uses *Python 2.7.X*, *bsdiff* and *Java* (you may need to install the
m in your system) |
| 13 |
| 14 For the file-by-file estimation we use a jar (at /lib/file-by-file-tools.jar) ge
nerated from: https://github.com/andrewhayden/archive-patcher |
| 15 |
| 16 #### To estimate the patches sizes of two APKs run: |
| 17 ```bash |
| 18 $ python apk_patch_size_estimator.py --old-file old.apk --new-file new.apk |
| 19 ``` |
| 20 |
| 21 #### Output: |
| 22 ```bash |
| 23 New APK size on disk: 18,271,850 bytes [17.4MB] |
| 24 |
| 25 Estimated download size for new installs: |
| 26 Full new APK (gzipped) size: 16,339,603 bytes [15.6MB] |
| 27 |
| 28 Estimated download size for updates from the old APK, using Bsdiff: |
| 29 Bsdiff patch (gzipped) size: 2,989,691 bytes [2.85MB] |
| 30 |
| 31 Estimated download size for updates from the old APK, |
| 32 using File-by-File: |
| 33 File-by-File patch (gzipped) size: 1,912,751 bytes [1.82MB] |
| 34 ``` |
| 35 |
| 36 ## Patches estimation process |
| 37 |
| 38 ### Bsdiff estimation |
| 39  |
| 40 |
| 41 ### File-by-file estimation |
| 42 Please visit https://github.com/andrewhayden/archive-patcher for further details
. |
| 43 |
| 44 ## Installing external dependencies |
| 45 The script uses *bsdiff*, *gzip*, *head*, *tail*, *bunzip2* and *java* binaries,
[**bsdiff**](https://www.freebsd.org/cgi/man.cgi?query=bsdiff) is the only one
not installed by defult in a unix based OS. |
| 46 |
| 47 #### Linux debian-based |
| 48 Install bsdiff: |
| 49 ```bash |
| 50 sudo apt-get install bsdiff |
| 51 ``` |
| 52 |
| 53 #### OS X |
| 54 Install bsdiff using [Homebrew](http://brew.sh/): |
| 55 ```bash |
| 56 brew install bsdiff |
| 57 ``` |
| 58 |
| 59 #### Windows |
| 60 |
| 61 The easiest way to run the script in Windows is by using [Cygwin](https://www.cy
gwin.com/), make sure you install *python* and *bsdiff* using Cygwin's installer
/setup. |
| 62 |
| 63 ## Runing the unittests |
| 64 |
| 65 #### Install unittest.mock |
| 66 ```bash |
| 67 pip install mock |
| 68 ``` |
| 69 |
| 70 #### Run the test |
| 71 ```bash |
| 72 python -m unittest discover tests/ |
| 73 ``` |
| 74 |
| 75 ## Authors |
| 76 Julian Toledo |
| 77 Andrew Hayden |
| OLD | NEW |