Android热修复之微信tinker原理分析与接入实现

 2022-08-13 01:08

论文总字数:30927字

摘 要

关键词:Android,热修复,AOP编程,Dalvik,instant run

Source Code of Android Hot-Patch Analysis And Implementation of Tinker

71113429 Wang Ruikang

Supervised by Fang Xiaolin

Abstract: With the popularity of Android phones, people demand for mobile applications more and more. Each app supplier is accelerating the update iteration speed of the product, and accordingly, bug fixes, data statistics work becomes more arduous. In this context, the thermal repair technology began to develop, the major application vendors began to design their own thermal repair program. By 2017, thermal repair has been widely used in the major excellent app, such as Taobao, Alipay, WeChat. Kaixindai hot repair project will also start. Android hot fix can be divided into native genre and Dex genre. The representative hotpatches of the native genre are TaoBao Dexposed framework, and Alipay's AndFix program. And in Dex genre, QQ space ClassLoader program and WeChat Tinker which recently open source is more famous. This thesis will analyze the principles of the four solutions above from the source point of view, and compare the advantages and disadvantages of them from the production point of view. The final selection of the best performance of the WeChat Tinker program, will be connected to the Kaixindai app for thermal repair test.

Keywords: Android, hot fix, AOP program, Dalvik, instant run

目录

Android热修复源码分析及Tinker接入实现 I

Source Code of Android Hot-Patch Analysis And Implementation of Tinker II

第一章 绪论 1

1.1 Android热修复的研究背景 1

1.2 Android热修复的意义 1

1.2.1. 轻量而快速的升级 1

1.2.2. 远端调试 2

1.2.3. 数据统计 3

1.3 Android热修复的发展 3

1.4 论文组织结构 3

第二章 主流热修复原理分析 4

2.1 Dexposed框架 4

2.1.1. 准备知识点 4

2.1.2. Hook API的基本用法 5

2.1.3. 补丁框架源码分析 6

2.1.4. hook框架源码分析 7

2.1.5. Dexposed框架总结 8

2.2 QQ空间热补丁 8

2.2.1. 准备知识补充 9

2.2.2. 解决CLASS_ISPREVERIFIED标记问题 10

2.2.3. ClassLoader方案的缺陷 11

2.3 AndFix 12

2.3.1. AndFix源码分析 12

2.3.2. AndFix框架流程总结 14

2.3.3. apatch工具原理解析 14

2.3.4. AndFix技术总结 15

2.4 Tinker 15

2.4.1. Instant Run工作原理 15

2.4.2. Application替换 16

2.4.3. 补丁加载 16

2.4.4. Dex热更新 17

2.4.5. 资源热更新 18

2.4.6. so文件热更新 19

2.4.7. DexDiff补丁生成原理解析 20

2.4.9. 微信Tinker优缺点总结 22

2.5 本章小结 23

第三章 各大热修复方案比较 24

3.1 平台支持比较 24

3.2 修复类型比较 24

3.3 基本属性比较 24

3.4 成功率比较 25

3.5 热修复选型 25

3.6 本章小结 25

第四章 对微信Tinker的接入实现 26

4.1 集成与初始化配置 26

4.2 debug版本功能测试 27

4.3 release版本和代码混淆 29

4.4 本章小结 29

第五章 总结与展望 30

5.1 项目总结 30

5.2 展望 30

致 谢 31

参考文献 32

第一章 绪论

1.1 Android热修复的研究背景

自Google发布Android1.0以来,Android市场占有量不断上升,很快成为移动端第一操作系统。如今,人们对移动应用的需求越来越高。应用提供商必须不断为app实现新的需求。在这个过程中,热修复技术开始走进Android开发者的视野。

近年来,热修复技术受到广泛关注。一些APP厂商也开始设计自己的热修复方案,如手机淘宝的Dexposed框架,支付宝的AndFix,以及最近开源的微信Tinker。它们在原理上各不相同,适用的场景也有所不同,那么,在实际开发中具体使用哪种方案,是本文需要关注的问题。本论文从源码角度,分析各大开源方案,并作出横向比较,帮助开发者从原理的角度更熟练地使用热修复技术。

1.2 Android热修复的意义

以往的移动应用发布流程中,产品上线后出现问题,通常的处理办法是发布新的版本,用户在客户端手动更新APP。但随着移动应用的逻辑越来越复杂,代码量也较之前有了很大的提高,出现问题的几率也不断上涨。有时一个严重的bug,可能仅仅是因为一个方法甚至一行代码的问题,但为此需要付出的人力物力以及时间成本依然巨大。所以,单纯靠发布更新版本修复bug已经不能满足客户的需求,会对所负责的业务带来巨大的损害。若是大型APP,版本发布的排期更是需要多方协调。因此,对热修复的研究进入各大厂商工作计划。

热补丁的定义是让应用在无需重新安装的情况下实现代码更新,广义上也包括资源文件更新,可以使应用在用户无感知的情况下动态修复bug。由此可见,热补丁技术确实可以解决APP版本更新问题,降低更新成本。但这并不意味着热补丁就可以代替版本更新。因为热补丁技术现阶段仍有一些明显的缺陷:

剩余内容已隐藏,请支付后下载全文,论文总字数:30927字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;