Hotfix-Tinker, fix-tinker
Open source is a great surprise. You have to check it out. It is much better than nuwa. In addition, there are dedicated official documentation on github, and there are still a lot of data queries.
Reference: https://github.com/Tencent/tinker/wiki
Https://github.com/Tencent/tinker/wiki/Tinker-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97
I think about some complicated ideas that I had to subscribe to during my previous studies. Now, when I develop to this level, I have to go to the house for three days. It is a good metaphor for the Internet, so learning cannot be broken, it may be a few stages of development without knowing it.
I know the comparison chart. The difference between the method and the QQ space is that there is no plug-in, and there is almost no performance loss when there is no patch. During patching, You need to delete the Core Loading class.
The document is still quite detailed. According to the document, it will be okay if it passes through.
The first step is to download the demo, and then the document introduces several solutions. It also recommends gradle generation configuration (see). This is also done in the demo, so we must follow this solution.
During integration, the TINKER_ID used in the gradle configuration in the demo is the git version number obtained. This is troublesome. The document has ended and can be changed to versionName. I will change the versionName, this TINKER_ID must be consistent, otherwise it will fail
Then run the program directly or build the apk. After the program is successfully built, the apk will be generated in your project Path app \ build \ bakApk.
Then you can modify your bug. After modification, you can use the command line gradlew tinkerPatchDebug on the As terminal, but you cannot directly change the name of your own apk, that's over.
Then we can see successful. At this time, the apk will be generated in the directory of your project. app \ build \ outputs \ tinkerPatch \ debug \
This is your patch. Just put this apk in the root directory of the mobile phone.
Click Open your app and click load patch. You will see a toast that prints the patch success and please restart process, click show info to view the detailed information. The patch package has been loaded successfully. github itself has a lot of information to introduce. You can take a look at it with a good blog written by others, so that you can learn more quickly.
/**
* Personal understanding
* In view of the shortcomings of the QQ space superpatch technology, a solution is proposed to provide DEX difference packages and replace DEX as a whole. The main principle is that it is basically the same as the QQ space super patch technology. The old DEX is replaced as a whole to achieve the purpose of restoration.
**/
SampleApplication is automatically generated by gradle, inherited from TinkerApplication, and then set to catch code exceptions. onBaseContextAttached is the key code we are looking.
The Code roughly reflects the call to TinkerLoader's tryLoad () method to obtain the loading patch result, load the patch package, reflect the call synchronization cycle, reset the number of times of security mode, or greater than or equal to three times will enter the security mode and no longer load, A little understanding
In-depth research is very complicated. As ZHANG Shaowen said, this is really a way to kneel down, and we don't have to kneel down. Let's take a ride first.