In case you want to re-sign your apk with a different keystore one day you might be delighted to hear that there is a convenient shell script for this already.

It basically removes the java manifest meta file, then runs zip align and the apk signing tool of the android sdk. It naturally requires the apk, the keystore with its alias and password.

Here is the script:

In order to run it, add execution permission in the terminal:

Then simply run the script by adding the parameters.

Have fun.