Android APK compilation, packaging, and signature

Source: Internet
Author: User

I always wanted to figure out how Android APK was compiled and packaged and signed to publish the application ?? Today, I spent a few hours checking information on the Internet and finally figured out the entire process of compiling and packaging APK signatures.

PS: There are three methods to complete the compilation and packaging tasks for the android program. For more information, see connection: Android compilation, packaging, and signature. I used the eclipse + ADT method, and compile the signature in cmd, hoping to help you;

 

1. Package unsigned APK in eclipse

In eclipse, right-click the corresponding project and choose Android tools -- export unsigned application package.

2. Pack signed APK in eclipse

In eclipse, right-click the corresponding project and choose Android tools -- export signed application package.

Next

Select the existing signature file keystore. Note that you need to know the password. If there is no keystore, You can compile a keystore by yourself in the exercise. For more information, see APK signature settings.X: \ csdn blog article \ APK packaging exercise

Create the signature file mysign. keystore step: PS: keystore is generated by the built-in JDK tool keytool.

1. Go to the CMD command line and run CD to the JDK/bin directory;

2. Enter:

Command: The mysign. keystore generated by keytool-genkey-alias asaiandroid. keystore-keyalg RSA-validity 20000-keystore asaiandroid. keystore is in the JDK/bin directory.

Explanation:-alias follows the alias. Here is asaiandroid. Store.

-Keyalg is the encryption method. Here it is RSA.

-Validity is valid. The value is 20000.

-Keystore is the name of the keystore to be generated. Here is asiandroid. keystore.

Then press enter and press Enter. The system will first prompt you to enter the password: This is used for signature. Remember it and then confirm your password. You will be asked to enter the name, organization unit, organization name, city region, province name, country code in turn

After setting the information, enter the original password again for confirmation, then enter yes/no for confirmation to complete the signature, and generate the mysign. keystore signature file;

Appendix: Search for files under cmd:

Start with unsigned.apk signature step: PS: unsigned.apk mysigned. keystore must be in the same folder. Because keytool environment variables are not configured, all the files required temporarily are placed in the JDK/binfile directory; Use jarsigner

Command: jarsigner-verbose-keystore mysign. keystore-signedjar androidtest_signed.apk androidtest.apk mysign.keystoregenerated lotteryonline_signed.apk is in the JDK/bin directory.

Explanation:-keystore: keystore name

Androidtest_signed.apk: signed APK

Androidtest.apk: APK before signature

Press enter to enter the password you just set. Press enter to start signing.

PS: Cause of the first signature failure: androidtest.apk is not in the JDK/bin directory with mysign. keystore;

Postscript:

APK Package Structure Overview: Go

Http://www.eoeandroid.com/forum.php? MoD = viewthread & tid = 100000.

 

Follow-up:

Keytool-genkey command explanation:

 

Start Android emulator in cmd:

Prerequisites: configure the environment variables for Android-SDK tools

Command: Android AVD (any directory)

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: 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.