Now, we need to sign the unsigned APK and run an alignment utility on it to optimize it and prepare it for the app store. If you already have a signing key, skip these steps and use that one instead.
Let’s create keystore file using this command Syntax:
keytool -genkey -v -keystore .keystore -alias -keyalg -keysize -validity
For Example :
Step 1 : set path cd C:\Program Files\Java\jre7\bin in command line Step 2 : keytool -genkey -v -keystore Helloworld.keystore -alias Helloworld -keyalg RSA -keysize 2048 -validity 10000
Follows the belows steps to generate Signed APK
Step 1: set path C:\Program Files (x86)\Java\jdk1.8.0_20\bin in command line
Step 2: jarsigner -verbose -keystore /path_to_keystore/keystoreFileName /path_to_apk_file/application_name.apk keystoreFileName_alias
For example: jarsigner -verbose -keystore C:\Users\admin22\Ionic_project\First\Helloworld.keystore C:\Users\admin22\Ionic_project\helloWorld\platforms\android\build\outputs\apk\android-release-unsigned.apk Helloworld
-keystoreFileName_alias. You have to provide your alias name of your keystore file name.
Step 3: Enter password of your keystore file
Step 4: Completed. It will displays warning messages like certifaction validity etc..
Step 5: Verify your apk file jarsigner -verify /path_to_apk_file/application_name.apk
For example : jarsigner -verify C:\Users\admin22\Ionic_project\helloWorld\platforms\android\build\outputs\apk\android-release-unsigned.apk
jarsigner -verify -verbose -certs C:\Users\admin22\Ionic_project\helloWorld\platforms\android\build\outputs\apk\android-release-unsigned.apk
Zip align:
Step 6: set path C:\Program Files (x86)\Android\sdk\build-tools\android-4.4W in command line
Step 7: zipalign -v 4 /path_to_apk_file/application_name.apk /path_to_destination_apk_locaion/zipped_application_name.apk
For example : zipalign -v 4 C:\Users\admin22\Ionic_project\helloWorld\platforms\android\build\outputs\apk\android-release-unsigned.apk C:\Users\admin22\Ionic_project\helloWorld\platforms\android\build\outputs\apk\final.apk