-
Notifications
You must be signed in to change notification settings - Fork 43
热修复
cheyiliu edited this page Aug 12, 2016
·
7 revisions
- 近一两年 Android 热补丁框架非常热门。从最初 360 动态下发 lua 脚本,到后来出现的各种方案,如雨后春笋般出现。早期的补丁框架偏向于以代码修复为主,主要分为两大类:native hook 方案和 Multidex 方案。native hook 方案如阿里巴巴的 AndFix 和 Dexposed。Multidex 方案如 Qzone。切入点都是替换掉将要执行的代码。基于 Qzone 方案的思路,出现了 nuwa 这个比较完善的库,工具链比较完善。
- 近期出现新方案-微信的Tinker
- http://blog.csdn.net/cheyiliu/article/details/48523863
- https://github.com/cheyiliu/test4XXX/tree/master/test4AndFix-master
- Nuwa是基于qq空间的方案实现的
- 利用asm字节码修改技术,在编译期间插入字节码,解决CLASS_ISPREVERIFIED问题。这就需要让所有的class都引入一个其他dex的类。于是,在gradle打包的时候,通过gradle插件向app中所有class的构造方法中插入代码。
if (Boolean.FALSE.booleanValue()) {
try {
System.out.println(com.xx.hotpatch.hack.class);
} catch (Exception e) {
}
}
- 利用class loader机制,将需要修改的class单独打成一个dex,然后通过反射的方式插入到ClassLoader中,并且让其位于dexElement数组的前面。
- Nuwa分两个工程
- 负责利用反射将patch插入到class loader的dexelements最前面 https://github.com/jasonross/Nuwa
- 负责利用利用字节码插入技术,在编译期间在每个类的构造函数里插入代码,解决CLASS_ISPREVERIFIED问题 https://github.com/jasonross/NuwaGradle
- TODO,待开源
- http://blog.csdn.net/lmj623565791/article/details/49883661
- 安卓App热补丁动态修复技术介绍
- 腾讯Bugly- Android Patch 方案与持续交付
- qq group 561394234
- jspatch, 在github上开源的 https://github.com/bang590/JSPatch
Just build something.