Skip to content

Latest commit

 

History

History
77 lines (65 loc) · 5.22 KB

README.md

File metadata and controls

77 lines (65 loc) · 5.22 KB

release license PRs Welcome +issue Welcome

Build Status Build status

a C++ library and command-line tools for Zip(Jar,Apk) file Diff & Patch; create minimal delta/differential; support Jar sign(Apk v1 sign) & Apk v2 sign & [Apk v3 sign] .
You can use this library (and Android NDK) to delta update your Apk.
( not support zip64, and only support decode Deflated code; dependent libraries HDiffPatch, zlib, lzma. )
[中文说明]


Releases/Binaries

Download from last release : Command line app for Windows , Linux , MacOS; and .so .java for Android.

usage:

  • ZipDiff(oldZip,newZip,out diffData)
    release the diffData for update oldZip;

  • ZipPatch(oldZip,diffData,out newZip)
    ok , got the newZip;
    ZipPatch() requires 4*(decompress stream memory) + ref old decompress memory + O(1), also ref old decompress can use temp disk file without memory;
    ZipPatch() support multi-thread parallel compress mode when writing zip file, which requires more and more memory! (NOTE: patch by multi-thread need ApkNormalized zip files)

  • NOTE:
    if your need newZip(patch result) file byte by byte equal, Released newZip := ApkNormalized(newZip) before run ZipDiff, AND You should not modify the zlib version (unless it is certified compatible);
    if your apk(or jar) file used Jar sign(Apk v1 sign), is same as zip file;
    if your apk used Apk v2 sign(or later), Released newApk := AndroidSDK#apksigner(ApkNormalized(newApk)) before ZipDiff;

  • NOTE:
    ApkDiffPath can't be used by Android app store, because it requires re-signing apks before diff.
    sfpatcher not require re-signing apks (like archive-patcher), is designed for Android app store, patch speed up by a factor of xx than archive-patcher & run with O(1) memory.


Why need ApkDiffPatch or Google Play's archive-patcher after having BsDiff or HDiffPatch?

ApkDiffPatch   : v1.0
archive-patcher: v1.0  ( test by https://github.com/googlesamples/apk-patch-size-estimator )
BsDiff         : v4.3
HDiffPatch     : v2.2.6
=========================================================================================================
                                                          BsDiff HDiffPatch archive-patcher ApkDiffPatch
          oldVersion              newVersion      newSize  (bzip2)  (+zlib)    (+gzip)   (+zlib)  (+lzma)
---------------------------------------------------------------------------------------------------------
chrome-63-0-3239-111.apk chrome-64-0-3282-123.apk 43879588 32916357 32621974  18776996  15995242 13896562
chrome-64-0-3282-123.apk chrome-64-0-3282-137.apk 43879588 28895294 28538751   1357320   1341073  1149331
chrome-64-0-3282-137.apk chrome-65-0-3325-109.apk 43592997 31771385 31540550  16427116  14415021 12356765
google-maps-9-70-0.apk   google-maps-9-71-0.apk   50568872 37992141 37531799  17293163  14562607 11430622
google-maps-9-71-0.apk   google-maps-9-72-0.apk   54342938 41897706 41475595  21301751  18752320 14066134
weixin660android1200.apk weixin661android1220.apk 61301316 17565557 17372003   1927833   1794219  1659286
weixin661android1220.apk weixin662android1240.apk 63595334 38349926 38025483  22100454  18392769 15556315
weixin662android1240.apk weixin663android1260.apk 63595326 11614415 11531258   1044656    937920   940060
weixin663android1260.apk weixin665android1280.apk 63669882 21423459 21176790   9621032   9003472  7392063
---------------------------------------------------------------------------------------------------------
Average Compression                                100.0%    56.3%    55.8%     23.5%     20.4%    16.8%
=========================================================================================================

Contact

housisong@hotmail.com