#介绍
开源框架阿里巴巴的AndFix,允许APP在不重新发布版本的情况下修复线上的bug。支持Android 2.3 到 6.0。
#使用方式
##添加依赖库
1
| compile 'com.alipay.euler:andfix:0.4.0@aar'
|
##添加so文件
可以参考https://github.com/zhonghanwen/AndFix-Ndk-Build-ADT
#Application代码
##
1 2 3
| patchManager = new PatchManager(this); patchManager.init(getAppVersion());//current version patchManager.loadPatch();
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| try { patchManager.addPatch(Environment.getExternalStorageDirectory() + "/v.apatch"); Log.i("MyApplication","success"); }catch (Exception ex){ Log.i("MyApplication",ex.getMessage()); Log.i("MyApplication",Environment.getExternalStorageDirectory().toString()); }
public String getAppVersion(){ String appversion=""; try { appversion = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; }catch (PackageManager.NameNotFoundException ex){
}finally {
}
return appversion; }
|
#生成补丁文件Patch
##工具 apkpatch
1
| ./apkpatch.sh -f volly2.apk -t volly.apk -k guosen.jks -p 123456 -a lin -e 123456
|