Android wechat Tinker hot update details

Let's take a look at the renderings first

Tinker known issues

Due to principle and system limitations, Tinker has the following known problems:

1. First, integrate the tinker plug-in in the build of the project, as shown below (the latest version is 1.7.6)

First look at the structure diagram. There are only a few classes:

Build integration in project

1. Add the associated attributes in the build of the app. These attributes have been tested and comments show that if you need other attributes, you can check and integrate them on GitHub. The address will be sent at the end of the article. PS: the official integration is particularly troublesome. Sometimes you may not be able to do it all day. Add them according to your own needs and circumstances, A demo will be sent at the end

3. Integrate the application and service in the manifest file. The application of name must be. Amsky. If you can't add it or it's red, please build it first. If you already have your own application, I'll talk about how to integrate it later. The operation in the service will prompt you that the update is successful after you load the hot update plug-in successfully, And if you lock the screen here, the hot update plug-in will be loaded. Continue to look down.

4. The basic integration is almost complete here. The rest is the integration in the code. The first is the application. Here we mainly talk about how to change the operation when it is an existing application. This applicaiton can be said to be an application of its own, but it is written in this way. To write in this way, you can do some of your own operations in oncreate, Just write amsky in the manifest file

5. Here is to load the hot update file in mainactivity. When you click load, you can directly lock the screen and load it (do not delete the service). Of course, exit the app. Can you load it next time? If you load the patch plug-in here, the path can be set by yourself. I put it in the debug folder in the root directory, and my patch plug-in name is patch, You can change it yourself.

6. Service file

7. Utils file

The integration has been completed here. Let's talk about the methods used in the next step

This is a buggy version. We use assemblydebug to test. Note that there is no bakapk folder in the build folder before clicking assemblydebug

2. After clicking assemblydebug, the bakapk folder will appear with APK files in it. If it fails, remember to clean and build

3. Next, in the build folder, change the attributes in Ext, and copy the APK file and R file generated in bakapk to ext. if the release package you typed has mapping, you can also copy it here. Here is a debug test, so there is no mapping file

4. The following is to modify the bug we need to update or change. Here I add a picture and change the title display

This is a buggy version. I haven't added pictures or changed the title yet

Here I added a picture of AA and changed the title

5. Next, we run tinkerpatchdebug under Tinker to generate a patch package, which is under outputs

After clicking finish, the tinkerpatch folder will be generated

Place the patch under the tinkerpatch folder_ signed_ 7zip.apk file, paste it and change it to the name of the file loaded in your mainactivity. I call it patch here, and then click load before loading

After loading, lock and unlock the frequency, the patch has been loaded, and the patch in the folder is no longer there, because it is merged with the old APK

be careful

The signature file is set in the signingconfigs of build and the kestore folder on the left, as shown in the following figure

Project GitHub address: tinkerdemo

Tinker original project address: https://github.com/Tencent/tinker Tinker User Guide: https://github.com/Tencent/tinker/wiki Tinker one click integration (this is simple, but you can't download patches from your own server. You don't need to configure Tinker's own background. There are some limitations, so you can choose by yourself) : https://github.com/TinkerPatch/tinkerpatch-sdk/blob/master/docs/tinkerpatch-android-sdk.md Tinker one click integration background: http://www.tinkerpatch.com/

For more highlights, please click Android wechat development tutorial summary and Java wechat development tutorial summary. You are welcome to learn and read.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>