In command mode, enter the Bin subdirectory of the JDK installation directory. (My JDK is installed on the E drive, so I first enter the E drive, and then enter the JDK installation directory. )
Create a keystore through the keytool.exe tool.
First, enter the following command:
keytool-genkey pair-alias-my demo . keystore-keyalg RSA-validity 100
-keystore mydemo.keystore
Second, the order is as follows:
-genkeypair: specifies to generate digital confirmation.
-alias: Specifies the alias used to generate the digital certificate.
-keyalg: specifies the algorithm for generating digital certificates, such as RSA algorithm.
-validity: Specifies the validity period of the generated digital certificate.
-keystore: Specifies the storage path used to generate the digital certificate. (The default directory here is the keytool.exe directory).
Enter and the interactive interface as shown in the figure will appear. Enter the digital certificate fee, password, author company and other details.
When finished, the keystore library is created, and you can find it in the specified saving directory.
Use the jarsigner command to sign the unsigned APK installation package. Use the jarsigner.exe tool in the bin subdirectory of the JDK installation directory to sign.
Then copy the unsigned apk to this directory.
Third, use the following command to sign:
jarsigner-verbose-keystore my demo . keystore-signed jar
-note . apk notes . apk my demo . keystore?
Four. Description of the above order:
-verbose: Specifies to generate detailed output.
-keystore: Specify the digital certificate storage path.
-signedjar: The three parameters of this option are signed apk package, unsigned apk package and digital certificate alias. Please pay attention to the expiration date.