Configuring Cordova to update the Android version code

When releasing to the Google play store a numeric android version code needs to be given as well as the semantic version number that the end users will see.

This needs to be incremented on every release to the store in the "platforms/android/AndroidManifest.xml" file. Your project's "platforms" directory should not be stored in version control, so it can be deleted if needed and regenerated by Cordova.

Rather then having to refer back to the play store for the last android version code, instead you can set the value in cordova's own "www/config.xml" and let cordova update the "AndroidManifest.xml" file automatically.

Here is an example of the widget tag in the "config.xml" file

<widget id="" version="1.0.0" android-versionCode="1" xmlns="">

This will update the manifest version when the following cordova command is run:

cordova build android

This feature is reported to work with Cordova 3.5 and above.

Last updated: 09/07/2014