01_android app development Environment _05_ signed Android app

Source: Internet
Author: User

Background:

The Android project is uniquely identified with his package, and if two apps with the same package name are installed on a single device, the post-install app overwrites the previously installed app.

Objective:

To avoid coverage, Android requires that the app be signed as a finished product.

Role:

    • Determine the publisher identity.
    • Ensure the integrity of your app.
The ADT plugin or ant tool in eclipse automatically generates a debug certificate to sign the Android app. If you want to officially publish an Android app, you must use the appropriate digital certificate to sign the application, and you cannot publish it using ADT or the debug certificate generated by the Ant tool.

Sign an Android app in eclipse

1. Right-click Project, Android tools→export singned application Package ...

2, if there is no digital certificate in the system, you can select the "Create New KeyStore" button in the window to fill in the storage path and password of the digital certificate.

3. After completion next,eclipse will pop up to let the user fill in the details of the digital certificate.

4. Next, specify the storage path of the APK installation package after the signature is generated.

5, Finish. This will generate a signed APK installation package under the specified directory.

Once the digital certificate is made, you can use the certificate to sign it most directly later.

To sign an apk with a command

1, create the Keysrore library, the JDK installation directory below the bin has a keytool.exe tool to generate digital certificates.

Keytool-genkeypair-alias-keyalg-validity-keystore

    • -genkeypair: Specifies that a digital certificate is generated
    • -alias: Specifies that a digital certificate alias is generated
    • -KAYALG: Specifies whether to generate a digital certificate, using the RSA algorithm
    • -validity: Specifies the validity period of the generated digital certificate
    • -keystore: Specifies the storage path of the generated digital certificate
Enter the command and enter it, then install the interactive interface to input the relevant parameters.

2, born into a signed apk,android tools→export Unsigned application Package ...

3. Sign the unsigned apk with the Jarsigner command, below the bin subdirectory of the JDK

Jarsigner-verbose-keystore-signedjar

Description

    • -verbose: Specifies that verbose output is generated
    • -keystore: Specifying a digital certificate store path
    • -singedjar: There are three parameters, namely the signature apk package, the unsigned apk package, and the alias of the digital certificate.
    • Enter the password for the digital certificate KeyStore in interactive mode.

4. Use the Zipalign.exe tool to optimize the APK installation package.

Zipalign-f-V 4 a.apk a_zip.apk

    • -F: Specifies that an existing file is forced to overwrite
    • -V: Specifies that verbose output is generated
    • 4: Specifies the number of bytes to be based on the file collation, usually specified as 4, which is based on 32 for collation.
    • a.apk, a_zip.apk: Specify the APK before finishing and the apk that is generated after finishing.

01_android app development Environment _05_ signed Android app

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.