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:
[crayon-615046be883b5377295391/] From Cordova CLI 5.0 on though, it seems as Ant isn’t the main building tool anymore and Gradle has been put into effect as the building tool for Cordova.
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:
[crayon-615046be883bf181334436/] 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:
[crayon-615046be883c5561104729/] And you’re good to go with Cordova CLI 5.0 once more