简介
AndFix为阿里开源的一个安卓热补丁框架,允许app在不发版的情况下修复部分bug,支持版本:2.3-6.0.
使用
1、gradle中添加关联:
compile 'com.alipay.euler:andfix:0.4.0@aar'
2、在Application继承类中,初始化:
patchManager = new PatchManager(context);
patchManager.init(appversion);//current version
(appversion可直接使用当前app的versionCode,若appversion改变,会自动删除所有已经加载的patch)
3、loadPatch:
patchManager.loadPatch();
4、addPatch:
patchManager.addPatch(path);//path of the patch file that was downloaded
在你下载patch文件成功后,即可调用。
ApkPatch生成差异文件
usage: apkpatch -f -t -o -k -p <***> -a -e <***>
-a,--alias keystore entry alias.
-e,--epassword <***> keystore entry password.
-f,--from new Apk file path.
-k,--keystore keystore path.
-n,--name patch name.
-o,--out output dir.
-p,--kpassword <***> keystore password.
-t,--to old Apk file path.
存在问题
1、不能增加类or新的字段;
2、补丁文件容易被反编译