APK patch size estimator


Source link: https://github.com/googlesamples/apk-patch-size-estimator

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

Usage

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

Output:

New APK size on disk: 18,271,850 bytes [17.4MB]  Estimated download size for new installs:
 Full new APK (gzipped) size: 16,339,603 bytes [15.6MB]  Estimated download size for updates from the old APK, using Bsdiff:
 Bsdiff patch (gzipped) size: 2,989,691 bytes [2.85MB]  Estimated download size for updates from the old APK,  using File-by-File:
 File-by-File patch (gzipped) size: 1,912,751 bytes [1.82MB]

Patches estimation process

Bsdiff estimation

File-by-file estimation

Please visit https://github.com/andrewhayden/archive-patcher for further details.

Installing external dependencies

The script uses bsdiff, gzip, head, tail, bunzip2 and java 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 

Resources

Restito is a tool which is inspired by mockito and functionally is diametrically opposite to the Rest Assured.

Restito provides a DSL to:

  • Mimic rest server behavior
  • Record HTTP calls to the server
  • Perform verification against happened calls

Testing and validation of REST services in Java is harder than in dynamic languages such as Ruby and Groovy. REST Assured brings the simplicity of using these languages into the Java domain.

A powerful, customizable and extensible ViewPager indicator framework.

Simple to use customizable Android Tooltips library based on PopupWindow. This Tooltips does not require any custom layout. It works as PopupWindow.

It's a cool animation which can be used on splash screen or somewhere else.

A simple view to show different states (empty, loading, etc.).

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes