I’ve already covered release signing Android application in Cordova in a previous article, but sometimes you want to do the same for debug builds. By default, Cordova uses its own debug keystore
, but it’s easy to customise your project to use a keystore
of your choice when creating debug builds.
Prerequisites
Start by creating your keystore
using the keytool
command line, as described in my earlier article.
If you already have a keystore
you would like to use, you can skip this step.
Setup
Next, we need to create the configuration file Cordova will use to sign your debug build. This is done by creating the debug-signing.properties
file in the platforms/android
folder of your app.
In this file, you’ll need to add the following:
Each of the variables must match the details you used when creating the keystore
(or in the Prerequisites step). If you didn’t enter passwords for the keystore
(storePassword
) or alias (keyPassword
), these lines can be removed from the file.
Building and Signing
When you’re ready to build and sign your app, you can simply run the following Cordova command:
cordova build android
If the build is successful, the android-debug.apk
file will be generated in the platforms/android/build/outputs/apk
folder. Keep an eye on the output to see if the build was successful, and to find the location of the file.
The above screenshot has been modified to hide intermediate output from the build process, and to redact confidential information.