- Create Release Build
Following command can be used to create release build for Android. This will generate a release build based on the settings in your config.xml. For every new release, you may want to change the version in config.xml file.
cordova build --release android
By executing above command in the home directory, one could find generated apk file with name such as android-release-unsigned.apk in the path platforms/android/build/outputs/apk.
- Create One-time Private Key: Next step is to generate private key which will be used to sign the APK file. Do note that this is one-time activity and once an APK is signed with private key generated using below command, one would have to keey the private key file intact. Playstore would need you to sign the APK file everytime with same private key.
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
- Sign the release build with Private key: Next step is to sign the APK with private key generated above. Following command can be used.
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystore name such as my-release-key.keystore> <path/to/apk> <alias name>
- Create the APK file: Lastly, you may want to set path to zipalign utility as Environment PATH variable. Zipalign tool can be found in the path such as /path/to/Android/sdk/build-tools/VERSION/zipalign.
zipalign.exe -v 4 <path/to/apk> <apk name>
- Upload the APK file to Playstore: Login to Google playstore and upload your APK file. For the first time, you may have to go through filling questionaires etc. If you are new to Google playstore, you may have to pay an annual fee as well.
Very Nice Explaination. Thankyiu very much,