Android App patch updates and androidapp Patches

Source: Internet
Author: User

Android App patch updates and androidapp Patches

I hope you will forgive me for having been busy for the last week. This week, I suddenly fell idle. When I had time, I reconstructed the code and accumulated some avant-garde technologies. So today, I will share my research on the past few days.

Mobile Internet focuses on user experience and Rapid Product iteration. Through user feedback and user behavior tracking, the product direction can be adjusted in a timely manner to maintain vitality and creativity. The ground point is that you frequently upgrade and update, sometimes only fix a few bugs or fine-tune the interface, so that users can download 10 megabytes or even larger apk, in addition, this 4G network is not widely used in China, and it is unfriendly to users. Is there a policy like patching on a windows system to improve the implementation of bugs or new functions in the system through small patches? If yes, the user will no longer suffer from updating the app. The answer is yes. The following two steps are required to implement this function.

1. Compare the differences between the new version and the old version, it is best to download only the differences

The idea is very simple and clear, so we will follow this goal. The apk itself is actually a zip package. You can change the suffix and double-click and decompress it to get the file after the apk is compiled and packaged. The files such as image and audio can be directly readable, you have to use the decompilation tool to check the other items. So the apk file of our application is a binary file. How can we get the difference file of the two binary files-the difference package? The good news is that it has already been implemented by our predecessors. Its name is bsdiff, a difference package comparison tool. Its full name is binary diff, which indicates binary difference. Through bsdiff, we can get two different apk packages. Below I will package the compiled command files into the code and upload them to Github for your use. Bsdiff only provides a set of Code implemented in C. You need to compile and build it yourself. I have prepared commands for different windows, OSX, and Linux platforms.

Since my computer is a macbook, run the following command:

Run the command and get xx. patch. The difference package will be downloaded below. According to the differences between different versions, compared with the entire apk, the size of the difference package will be much smaller. At the same time, if there are multiple old versions of your application, you need to generate multiple different packages. If you want to automate the generated process, you can easily solve it with the help of the background buddies.

2. Download the difference package locally on the mobile phone, merge it with the old apk version, and merge it into the new apk version.

Based on the current version number, you need to download the corresponding differential package to initiate a request to the server. The following is a step for merging the old apk and patch. Since java does not provide the corresponding api, we need C to help implement it and then generate a. so package for calling. Compared with the bsdiff that generates the difference package, it also provides another bspatch, which is used to help us achieve file peace. If you want to implement this step in Android, You need to configure the NDK development environment. If you don't want to, you can directly use the. so file in the demo. Call the following method to merge files.

The merged apk file has the same feature value as the latest installation package. Finally, use Intent for installation.

Conclusion: some users may use old versions, which is very different from the latest apk version, we recommend that you determine whether to directly download the apk and update it based on the size of the generated differential package. At the same time, different versions correspond to different packages. If we work with Our backend partners to automate the generation of different packages, this greatly reduces the waste of time for generating different packages. Finally, if you only fix critical bugs or add several new requirements, the difference package will be very small, and the user's download time and traffic consumption will be greatly reduced.

Source Code address:

If it is helpful to you, you are welcome to subscribe to my public account --Android sharing (ID: android_share). The QR code below provides you with timely and high quality Android dry goods.

Who can answer me the question about whether the android Application can be updated in a way similar to patching a program?

Google I/O mentioned Smart App update, that is, incremental update or differential update, which is supported in the new version of Google Play. It is to pack part of the code you want to upgrade into a patch file ***. p suffix, and then put the old apk file and the new. p files are synthesized by Synthesis tools to reduce traffic.

Apple's software can be used to update Android software in the app store. Where can it be used to update the official third-party update of the game last time?

There are no official websites. There are only some auxiliary classes, such as butler mobile guard and app babybox. They can detect locally installed programs and check the latest database version of each program and server, if updates are available, the number of updates and the update prompt are displayed.
Android is an open-source system, so such app store is almost impossible.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.