This is personal guide, that I always make for myself when I need to remember somthing, that I'll definetly will do once more.
First of all you'll need to create unsigned apk file, you can do it with following command in you PhoneGap application directory:
cordova build android --release
You could use
phonegap instead of
cordova, there is no difference.
Next step is to sign you apk file. In my situation output file was in
\platforms\android\ant-build directory. Following guide help me and I'll summarize information from it.
First you need to accquire keystore file. As I could understand, you'll need this file if you want to sell you application to someone else. Following command will help you to genereate keystore:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Then you should execute set of commands to sign you application. You should be in the same directory where your unsigned apk file is.
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /Users/username/Documents/path/to/my-release-key.keystore AppName-release-unsigned.apk app_name jarsigner -verify -verbose -certs AppName-release-unsigned.apk zipalign -v 4 AppName-release-unsigned.apk AppName.apk
You should track error messages on each step, because sometimes commands could fail, but errors were easy to fix. If everything is done right, you'll see message Verification successful after last command and your application file will be ready to upload in Google Play.