热修复 常见的热修复框架简介

Native 系

阿里的 Dexposed 3.9K

dexposed enable 'god' mode上帝视角 for single android application.

阿里的 AndFix 6K+【主流】

AndFix is a library that offer hot-fix for Android App.

Java 系

微信的 Tinker 12K【超级主流】

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

大众点评的 Nuwa 2.9K

Nuwa is a goddess in ancient Chinese mythology best known for repairing the pillar of heaven. 
女娲是中国古代神话中的女神,以修复天堂柱而闻名。
With this Nuwa project,you can also have the repairing power, fix your android applicaiton without have to publish a new APK to the appstore. 
有了这个Nuwa项目,您还可以拥有修复能力,修复您的Android应用程序而无需将新APK发布到应用商店。

美团的 Robust 2.7K

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
Robust是一款具有高兼容性和高稳定性的Android HotFix解决方案。Robust可以立即修复错误,无需重新启动。

Qzone超级补丁 HotFix 1.6K

安卓App热补丁动态修复框架

百度金融的 RocooFix 1.5K

another hotfix framework

饿了么的 Amigo 1.3K-

A hotfix library for Android platform, and not just this...


美丽说蘑菇街的 Aceso 1K-

A hotfix library for Android

常见的几个热修复框架的对比

热修复框架的种类繁多,按照公司团队划分主要有以下几种:
类别 成员
阿里系 AndFix、Dexposed、阿里百川、Sophix
腾讯系 微信的Tinker、QQ空间的超级补丁、手机QQ的QFix
知名公司 美团的Robust、饿了么的Amigo、美丽说蘑菇街的Aceso
其他 RocooFix、Nuwa、AnoleFix

虽然热修复框架很多,但热修复框架的核心技术主要有三类,分别是 代码修复、资源修复和动态链接库修复,其中每个核心技术又有很多不同的技术方案,每个技术方案又有不同的实现,另外这些热修复框架仍在不断的更新迭代中,可见热修复框架的技术实现是繁多可变的。

部分热修复框架的对比如下表所示:
特性 AndFix Tinker/Amigo QQ空间 Robust/Aceso
即时生效
方法替换
类替换
类结构修改
资源替换
so替换
支持gradle
支持ART
支持Android7.0
我们可以根据上表和具体业务来选择合适的热修复框架,当然上表的信息很难做到完全准确,因为部分的热修复框架还在不断更新迭代。

从表中也可以发现Tinker和Amigo拥有的特性最多,是不是就选它们呢?也不尽然,拥有的特性多也意味着框架的代码量庞大,我们需要根据业务来选择最合适的,假设我们只是要用到方法替换,那么使用Tinker和Amigo显然是大材小用了。另外如果项目需要即时生效,那么使用Tinker和Amigo是无法满足需求的。

Tinker 和 AndFix 的比较

Tinker的功能非常强大,基本除了AndroidManifest.xml文件和tinker本身少数几个类之外,其他内容都能替换,包括布局、资源
但是接入麻烦,上手难度较AndFix高很多。

和Tinker不同, AndFix上手非常容易, 只需寥寥数行代码即可 ,但 没有Tinker功能多。
由于AndFix实现原理是底层通过c++直接操作指针实现,它可以做到加载补丁后实时生效,但它目前只支持替换方法实现内容,不能增加类也不能增加、修改字段。

Tinker QZone AndFix Robust
类替换 yes yes no no
So替换 yes no no no
资源替换 yes yes no no
全平台支持 yes yes yes yes
即时生效 no no yes yes
性能损耗 较小 较大 较小 较小
补丁包大小 较小 较大 一般 一般
开发透明 yes yes no no
复杂度 较低 较低 复杂 复杂
gradle支持 yes no no no
Rom体积 较大 较小 较小 较小
成功率 较高 较高 一般 最高
2018-6-9




猜你喜欢

转载自www.cnblogs.com/baiqiantao/p/9160763.html