android--------hot fix introduction

Hot repair technology has developed rapidly in recent years, especially after the launch of the InstantRun program, various hot repair technologies have emerged. Most of the mature mainstream APPs in China have their own hot repair technology, such as Hand Tao, Alipay, QQ, Ele.me, Meituan and so on.

 

Code hot fixes are the most common and the most important part of hot fixes, because program errors are often code logic errors. The original hotfix solution also only supports code hotfixes. Code hot fixes are divided into two genres, namely the class loading solution of the Tencent system and the underlying replacement solution of the Alibaba system. The former requires restarting the application but can fix most errors, while the latter takes effect in time but can only be modified within the method.

 

1:QZone

Qzone's super hot repair solution is one of the earliest hot repair solutions in the industry. Its principle is simple and ingenious, and its influence is profound and long-lasting.

 

2:Tinker

Tinker is WeChat's official Android hot-patch solution. It supports dynamic distribution of code, So libraries, and resources, allowing applications to be updated without the need for reinstallation.

 

3:Andfix

Ali's Andfix hot repair solution is a representative of the underlying replacement solution. It is completely different from the ideas of Qzone and Tinker. Andfix achieves repair by modifying the entry address of a method.

 

4 :InstantRun

In addition to code hotfixes, resource hotfixes are also common. Most mainstream solutions refer to the implementation of InstantRun in the implementation of resource repair. InstantRun includes code repair and resource repair.

 

5: SO library hot repair

The essence of the repair of the so library is to repair and replace the native method. Similar to the class loading scheme, the path of the patch so library can be inserted into the top of the nativeLibraryDirectories array, so that the patch library is loaded first instead of the original library to achieve the purpose of repair.

 

During the Qzone period, instrumentation affected the speed of class loading. Tinker's DexDiff algorithm is too fine-grained and complicated to implement, resulting in serious performance consumption. Andfix has limited usage scenarios and poor compatibility. In addition, Meituan's Robust and Ele.me's Amigo also have their own limit. Although Android hot repair technology is flourishing, there is no solution that can solve all problems and unify the current situation. Recently, Ali has launched Sophix, which has made in-depth optimization for various types of repairs. Although there is no open source code, it has released "Exploring the Principles of Android Hot Repair Technology", which has attracted the attention of the Android community. The intention of the repair plan is also very obvious.


From Qzone to Tinker, from Andfix to Sophix, it can be seen that the hot repair technology is still rising and developing, and every new solution is launched to surpass the original solution. But at present, Ali does not plan to open source Sophix, and Tinker 2.0 is still on the way. There are still many deficiencies in hot repair technology in terms of performance, compatibility, and development transparency. Therefore, we cannot just be satisfied with understanding the existing solutions, but also go deep into the source code. To understand the principle, it is necessary to keep an eye on the latest developments in the industry.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325401549&siteId=291194637