Signature steps:
1. Create a key
2. Use the key in step 1 to sign the APK
Implementation of key creation in command line
Keytool.exe in JDK, which is used in the JDK directory
Command line:
Keytool-genkey-alias demo. keystore-keyalg RSA-validity 40000-keystore demo. keystore
Parameter description:
-Genkey generation key
-Alias zhanglei. keystore alias zhanglei. keystore
-Keyalg RSA uses the RSA algorithm to encrypt the signature
-Validity 40000 validity period: 4000 days
-Keystore zhanglei. keystore name
Steps:
Use the key created in the command line to sign the APK:
Command line:
jarsigner -verbose -keystore zhanglei.keystore -signedjar demo_signed.apk demo.apk demo.keystore
Parameter description:
-Verbose outputs detailed signature information
-Keystore zhanglei. keystore location
-Signedjar zhanglei_signed.apk demo.apk zhanglei. keystore and key library zhanglei. keystore
The following shows how to create a keystore for eclipse and export the signed APK.
The operation directory is as follows:
Right-click Android project à export Android Application à
The steps are as follows:
Create a key and set a password:
Set some attributes of the keystore, including aliases:
Export an APK File
When releasing a new version, remember to sign it with the same keystore. As follows:
Select an existing keystore and sign it.
Enter the password for submission:
Finish:
Use the zipalign command to compress and optimize the APK.
Command line:
Zipalign-V 4 D: \ androidkeystore \ qtgxw.apk final.apk
Note:
-V [verbose output] Detailed output
So far, the key and optimization of the APK have ended.