From Cordova to App Signature Distribution (Android)
-
Cordova packages apK for release:
Run instructions at the project terminal
cordova build android --release
Copy the code
An unsigned APK will be generated in project \platforms\ Android \app\build\outputs\apk\release
-
Generate keystroe
C:\Program Files (x86)\Java\jdk1.8.0_202\bin (C:\Program Files (x86)\ jdk1.8.0_202\bin
keytool -genkey -v -keystore D:\mytest.keystore -alias mytest -keyalg RSA -validity 20000
Copy the code
-keystore D:/mytest.keystore Indicates the generated certificate and the directory where the certificate is stored. If you write the file name directly, the certificate will be generated in the current directory by default. -keyalg RSA Indicates the RSA algorithm. -validity 20000 Indicates that the validity period of the certificate is 20000 days.
Then fill in the relevant information and generate mytest.keystore
Note: The keystore to publish should be saved, because the keystore is authenticated in GooglePlay and will be updated in a later version
- Put the unsigned app.apk in C: Program Files (x86)\Java\jdk1.8.0_202\bin to execute the command
jarsigner -verbose -keystore mydemo.keystore -signedjar -SunfounderController.apk app-release-unsigned.apk mydemo.keystore
Copy the code
-verbose: generates detailed output
-keystore: specifies the path for storing the digital certificate
-signedjar: the three parameters of this option are the alias of the unsigned APK package digital certificate of the signed APK package
- Optimize the APK package put the signed APK in the folder where zipalign. Exe sits in the SDK and execute the instructions
zipalign -f -v 4 -Note.apk -Notes.apk
Copy the code
-f: forcibly overwrites existing files
-v Generates detailed output
4: Specifies the number of bytes that file collation is based on.
-Note. Apk: pre-optimized APK
-Notes.apk Optimized APK