November 2016

Tuesday, November 22, 2016

How To - build, sign and zipalign the already generated Android app apk file with existing key store file?



This process assumes you have html android application which you want to build, sign and zipalign in order to publish it to play store.
Build the apk using cordova command line:
1.       Open command prompt and go to the app folder path.
2.       Run the following command to generate release build
a.       Cordova build android –release
Sign the app with existing keystore
1.       Open command prompt and go to jarsigner path
2.       Jarsigner will be usually found in jdk\bin folder.
3.       Run the following command
a.       <JDK path>\bin>jarsigner -verbose -keystore <keystore file path> <apk path with apk file name> <key store alias>
4.       You will be prompted to enter the password of the key store file. Enter it.
5.       The apk will be signed but no new apk will be generated instead it’ll be overwritten.
Zipalign the apk file
1.       Open the command prompt and go to zip align path which can be found in android-sdks\build-tools\<version>
2.       Run the following command
a.       C:\Users\Yogeshwar.NR\android-sdks\build-tools\23.0.3>zipalign -f -v 4 <signed apk path> <to be generated apk file’s path>
3.       A new apk file will be generated in the specified path.

The output apk file of the last step can be published to play storeJ.