Creating a signed android release using cordova version 5 and above from the CLI
Cordova version 5 and above now uses the official android gradle build tool rather than the previous apache ant tool, this means that the release information now needs to be specified in a different location.
In a previous article titled Using the command line to create a production android release for a cordova application we showed how to setup the Java keystore and sign a cordova version 4 and below application.
Please follow the steps listed in the article mentioned above to first create a new Java keystore if you do not already have one.
Next, create a platforms/android/release-signing.properties
file after the android platform has been added to your project, this will reference the location of the keystore and optionally specify the passwords required to unlock it.
storeFile=/Users/user/Documents/yourapp.keystore
storeType=jks
keyAlias=youralias
// optional
keyPassword=yourkeypassword
storePassword=yourstorepassword
The command to build the release remains the same as the previous versions of cordova:
cordova build android --release
If you do not specify the password in the file above, they will requested via a GUI prompt.
For automation via CI it would be best to build the release-signing.properties
file dynamically from encrypted environment variables at build time.
Last updated: 29/03/2016