Updating an app on Play store is something which is a routine task if you wish to optimize the app and increase usability for the users. When we try to publish an update for an existing app to play store we SHOULD use the existing key store file which we used while initially publishing the app on play store.

While trying to achieve this, I have faced a few issues, and have found ways to do the same via Command/terminal.

You can use the same, below are the steps to do them.

I am taking an example where you have an 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
    1. 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
    1. <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
    1. <android SDK path>\android-sdks\build-tools\23.0.3
  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 store.