Wechat Android hot update Tinker usage details (XingKong Wuge)

What is Tinker

Tinker is the official Android hot patch solution of wechat. It supports dynamic distribution of code, so library and resources, so that applications can be updated without reinstallation. Of course, you can also use Tinker to update your plug-in.

It mainly includes the following parts: gradle compilation plug-in: Tinker patch gradle plugin core SDK Library: Tinker Android lib non gradle compilation user's command line version: Tinker patch cli.jar

Why Tinker

At present, there are many hot patch schemes on the market, among which the more famous ones are Alibaba's andfix, meituan's robust and qzone's super patch schemes. But they all have unsolvable problems, which is why we launched Tinker.

in general:

As a native solution, andfix first faces the problems of stability and compatibility. More importantly, it cannot realize class replacement, which requires a lot of additional development costs; Robot has high compatibility and success rate, but like andfix, it cannot add variables and classes, and can only be used as a bugfix scheme; Qzone can release products, but its main problems are the performance problems of Dalvik caused by pile insertion and the rapid increase of patch packages in order to solve the memory address problem under art. Especially after Android n, due to the modification of the inline strategy of mixed compilation, it is not easy to solve various solutions on the market. The tinker hot patch scheme supports not only the replacement of classes, so and resources, but also the full platform support of 2. X-7. X. Using tinker, we can not only use it as bugfix, but also replace the release of functions. Tinker has been running on hundreds of millions of Android devices on wechat, so why don't you use Tinker?

Tinker's known problems

Due to the principle and system limitations, Tinker has the following known problems: Tinker does not support modifying androidmanifest.xml, and tinker does not support adding four components; Due to the developer terms of Google play, it is not recommended to dynamically update the code in the GP channel; On Android n, the patch has a slight impact on the application startup time; Some Samsung android-21 models are not supported, and "tinkerruntimeexception: checkdexinstall failed" will be actively thrown when loading patches; Since the reinforcement implementations of various manufacturers are not consistent, Tinker no longer supports dynamic updates of reinforcement in versions 1.7.6 and later; Modifying remoteview is not supported for resource replacement. For example, transition animation, notification icon and desktop icon.

How to use tinker

Here's how to use buglytinker. Why use bugly hot update? Because bugly has integrated tinker, you don't need to pay attention to how Tinker synthesizes patches, you don't need to build your own patch management background, you don't need to consider anything about the patch distribution strategy in the background, and you don't need to consider the timing of patch download and synthesis, We provide a more convenient way to integrate Tinker. We ensure the security of patch distribution through HTTPS, signature verification and other mechanisms, rich distribution dimension control and effectively control the impact scope of patches. We provide a one-stop solution for application upgrading

As for how to use bugly hot update to look at the document, today I will talk about some errors in the multi-channel patch in the official website document (today, take bugly 1.2.2 (Tinker 1.7.6)) as an example

Add dependencies in build.gradle of project

Configure app build.gradle

It should be noted that there are errors in the three official configuration paths of project.tinkerpatch.oldapk, project.tinkerpatch.buildconfig.applymapping and project.tinkerpatch.buildconfig.applyresourcemapping. There are also multi-channel packaging bugs in Tinker 1.7.6 (this has been confirmed after communicating with the official). We will execute the following commands during multi-channel packaging, The patches he made are the same. It can be proved by viewing the yapatch.mf file in the patch package. The official website said it would be repaired in the next version

If you don't understand the signature method here, you can read this article: https://www.oudahe.com/p/24305/

If you don't understand the config.gradle configuration here, you can read this article: https://www.oudahe.com/p/24306/

Tinker-support.gradle configuration,

Configure config.gradle

Other configurations

Don't forget to confuse. There is also the configuration for adapting to the Android 7.0 system, which is not mentioned here.

Next, we execute the following command to start generating the benchmark package (be sure to keep the benchmark package)

tinkerPatchAllFlavorRelease

@H_ 404_ 121@

After the production version of APK is generated, if we find a bug, we can fix the bug and then generate a patch package.

After the patch package is generated, you can repair it with the help of bugly's hot update. Find our registered app and upload the patch package

Tinker checks whether there are patches on the server and whether there are patches locally when we open the app. If it is detected, download it, and then start the app next time to repair the patch. In this way, through bugly, we don't have to build a server to distribute patches, which is particularly convenient.

Source code: buglytinker_ jb51.zip

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>