Re-sign the APK File

Source: Internet
Author: User

 

1. GenerateAndroidAPK package signature certificate

1) switch to the JDK bin directory in Doc

Cd c: \ Program Files \ Java \ jdk1.6.0 _ 18 \ bin

2) run the following command

Keytool-genkey-alias android123.keystore-keyalg RSA-validity 20000-keystore android123.keystore

/* Explanation:Keytool is a built-in certificate tool for Java JDK.

-Genkey parameter: generate a certificate (security certificate for copyright and Identity Recognition)

-The alias parameter indicates that the certificate has an alias.-alias mine. keystore indicates that the certificate alias is mine.

-Keyalg RSA indicates the encryption type, and RSA indicates that encryption is required to prevent theft by others.

-Validity 20000 indicates the validity period of 20000 days (K3

-Keystore mine123.keystore indicates that the certificate name to be generated is mine123.

*/

 

After entering the carriage return, the screen is displayed:: A4 X: O. I5 I

Enter the keystore password: [do not display the password] (generally 20 digits are recommended. It is best to remember the password and use it later)

Enter the new password again: [do not display the password] (O' ^ $ _ (f (K & I0

What is your first name and last name?

[UNKNOWN]: Lili # e # C/Z! O) I; K6 R7 m-

What is the name of your organization?

[UNKNOWN]: Snoopy '| 3 V & I! _/
L

What is your organization name?

[UNKNOWN]: Snoopy team

What is the name of your city or region ?) L # V' |. E0 F ;{

[UNKNOWN]: Beijing

What is the name of your state or province?

[UNKNOWN]: Beijing

What is the two-letter country code for this unit?

[UNKNOWN]: CN-M .~ 1 W. I0

CN = Lili, u = Snoopy, O = Snoopy team, L = Beijing, St = Beijing, c = cn correct?

[No]: Y

Enter the master password of <mine. keystore>

(If the password is the same as the keystore password, press Enter ):

View c: \ Program Files \ Java \ jdk1.6.0 _ 18 \ bin, generate the certificate key for signature later: mine123.keystore

 

2. Delete the previous signature file

1) decompress the APK file with the decompression tool (for example, decompress it to D: \ sign \ phonebook)

 

Analysis of compressed Package content:

(1) META-INF Directory: stores signed cert and manifest files, used to identify the software signature and copyright.

(2) 7 L-W + O "F5G $ N4 d 'M & rres Directory: stores various original Android resources, including: animation anim, image drawable, layout, menu, XML, etc.

(3) * Q: F! S, B & D, D: Android project description file encoded in sandroidmanifest. XML, including the name, version, permission, and program component description of the android project.

(4) 7 | & n! L $ X (~ After 'aclasses. Dex is compiled, the class is converted into an executable bytecode file of the Dalvik Virtual Machine by the DX program.

(5) The compilation product of all text resources of qresources. ARSC, which contains the string resources corresponding to each location.

 

2) Find the directory META-INF below and delete the directory META-INF

3) use the zip tool to package the entire phonebook folder into a zip package and change the suffix to APK.
(Note: The second-level root directory does not exist in your phonebook.zip file)

 

 

3. re-sign the APK File

1). Copy the certificate to the same directory as the APK file to be re-signed (for example, copy to D: \ sign)

2) switch to the directory where you need to re-upload the APK file in the doc.

Cd d: \ sign

3). Run the following command

Jarsigner-verbose-keystore mine123.keystore-signedjar phonebook_signed.apk phonebook.apk mine. keystore

/* Explanation:* ^, {& K1 Z. M * P/M + K5 N5 hjarsigner is a Java signature tool #
K8 ~ % S # Y. @ 6 p

-Verbose parameter indicates that the signature details are displayed.

0 J-] '{1 Y8 H-keystore indicates that the mine123.keystore in the current directory is used to sign the certificate file.

# S: A-G7 E/V; O; V6 Z. s-signedjarPhoneBook_signed.apk indicates the name of the APK generated after the signature, % V! A7 E2 v4
W #]; gphonebook.apk indicates the unsigned APK Android software, and mine. keystore indicates the alias

*/

 

After entering the carriage return, the screen is displayed as follows:

 

View the D: \ signdirectory. The phonebook_signed.apk file has been generated for the new signature.

 

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.