Git Product home page Git Product logo

apk-patch-size-estimator's Introduction

APK patch size estimator

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

Usage

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)

To estimate the patch size of two APKs run:

$ python apk_patch_size_estimator.py --old-file old.apk --new-file new.apk

Output:

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]

Patch estimation process

Installing external dependencies

The script uses bsdiff, gzip, head, tail and bunzip2 binaries, bsdiff is the only one not installed by defult in a unix based OS.

Linux debian-based

Install bsdiff:

sudo apt-get install bsdiff

OS X

Install bsdiff using Homebrew:

brew install bsdiff

Windows

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

Install unittest.mock

pip install mock

Run the test

python -m unittest discover tests/

Authors

Julian Toledo
Andrew Hayden

apk-patch-size-estimator's People

Contributors

juliantoledo avatar

Watchers

James Cloos avatar Andrea Kim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.