Android Multi-channel packaging

Source: Internet
Author: User

Every time a product is released, it needs to hit a multi-channel package. Previously packaged with the per script, and later added custom spatial attributes, it was not possible to hit. The ant script is too cumbersome to package, citing too many projects. The last thing to think of is an anti-compilation.

Rationale: Each channel's package is not the same as the channel ID in the Androidmanifest.xml file. So after the anti-compilation apk, modify the channel ID of Androidmanifest.xml. Finally RePack.

Steps:

1. Decompile the apk that already has the package (it only uses-s, try to add-R, but the Androidmanifest.xml file is not recompiled, it is deleted)

1 java-jar apktool.jar  D-Apk_name

2. Modify the channel ID in the Androidmanifest.xml file

3. Generate an unsigned apk

1 java-jar apktool.jar  b file_dir unsign_apk_name

4. Sign the unsigned apk

1 jarsigner-verbose-keystore key_file_name-storepass password-sigalg sha1withrsa-digestalg Sha1-signedjar S ign_apk unsign_apk Alias_name

5. Optimize your signature apk

1 zipalign-v 4 sign_apk zipalign_apk

The new apk is generated. The above steps need to be configured with JDK and SDK environment variables.

You can write your own Java code, loop to replace the channel ID, you can automatically generate the corresponding channel package

Wrote a short, multi-channel packaging tool. Can be poked here for download. See the README.txt file in the download package for the usage method

Android Multi-channel packaging

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: info-contact@alibabacloud.com 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.