miércoles, 2 de diciembre de 2015

Cordova: Sign your app for Google Play

Cordova generates APK files for debugging purposes. But if you want to upload that APK to your Google Play account, you will receive an error.

Do this to get a release APK instead:

1) Create a keystore using the following command:

keytool -genkey -v -keystore /desired_folder/cordova.keystore -alias cordova -keyalg RSA -keysize 2048 -validity 100000

where "desired_folder" is the folder you want to place the keystore file.
replace "cordova.keystore" for the name you prefer.
you will be prompted for a password and some other personal info for your key.
after this, you will have a new file named "cordova.keystore"

2) Edit / create a file named "ant.properties" under "myCordovaApp/platforms/android" where "myCordovaApp" is the name of your app.

3) Add the following content:

key.store=/desired_folder/cordova.keystore
key.alias=cordova

where "desired_folder" is the folder you choose to place the keystore file.

4) Run the command as always for building your Cordova APK but for this time you need to add a --release parameter. Like this:

cordova build android --release

That's all folks!