Cordova 5.0 and signing your android app using cordova build –release

Reading Time: 2 minutes

One of the advantages of configurinAndroid Gradle buildg 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 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 looks like this:

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 file will be ignored and only the unsigned variant will be build.

Check out this post on how to sign your Android build again.

[ad name=”Generic Large Mobile Banner 320 x 100″]

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 ““.

You need to modify any after_prepare hook for file copying and create the file “” 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:

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 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:

And you’re good to go with Cordova CLI 5.0 once more