One of the advantages of configuring your Cordova builds on the cordova level involves using hooks just as Holly Schinsky (@devgirl) describes in her post: Three hooks your Cordova / Phonegap project needs.
Using file copying in a after_prepare hook enables you to copy, for instance, the ant.properties file in which you can setup the keystore and application key and even their related passwords so you can build the release package for your Android app signed an all.
An example of the ant.properties looks like this:
key.store=../../../AndroidRelease.keystore key.store.password=[secret] key.alias=Android key.alias.password=[secret]
When you’re hoping to see your release build being signed as usual with CLI 5.0 the ant.properties file will be ignored and only the unsigned variant will be build.
Check out this post on how to sign your Android build again.
So how ARE we going to update the release build signing? As this SO answer states, it seems that the default properties file that Gradle looks for is called “release-signing.properties“.
You need to modify any after_prepare hook for file copying and create the file “release-signing.properties” and save it in the same directory where build.gradle is located in your Android project.
Its structure looks a little similar to Ant’s configuration but it IS different:
storeFile=..\\..\\some-keystore.keystore storeType=jks keyAlias=some-key // if you don't want to enter the password at every build, you can store it with this keyPassword=your-key-password storePassword=your-store-password
NB: If you omit the passwords, it will ask for them during the build in your terminal / console window. If you DO add them it will build automatically which is easier – for CI related setups for instance – but obviously this would mean that your passwords are visible for anyone with rights to the config file!
If you’d like to create another file located somewhere else in your project (instead of the default release-signing.properties) you could create a sibling gradle file called “build-extras.gradle” and set it up so it points to another file. Check out the official Cordova documentation on the matter (look for “Extending build.gradle”).
With the new Gradle specific configuration set, you’re ready to sign!
Just build your release again, using:
$ cordova build --release
And you’re good to go with Cordova CLI 5.0 once more