Web Niraj
  • Facebook
  • Flickr
  • Github
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
Search the site...
  • Home
  • Blog
  • Cordova: Release Signing Android Applications

Cordova: Release Signing Android Applications

2

If you’re using Cordova 5.x+, it’s easy to configure it to also build signed release builds of your Android application. Providing you’ve already created a keystore using the keytool, this tutorial will have you building release builds in minutes, using the cordova build command.

Prerequisites

Before you start, you’ll need to create a keystore that will be used to sign the application. This can be done using the keytool that comes with Java.

$ keytool -genkey -v -keystore app.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

This will create a keystore called app.keystore, with alias alias_name. It will be valid for 10,000 days (~27 years). You will be prompted to enter a password to secure the keystore and alias.

Make a note of all the details you’ve used as we’ll need it to setup signing in Cordova.

Setup

Next, we need to create the configuration file Cordova will use to sign your release build. This is done by creating the release-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 --release

If the build is successful, the android-release.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.

Cordova-Android-Releas-Build

The above screenshot has been modified to hide intermediate output from the build process, and to redact confidential information.

If the file wasn’t setup correctly, or the changes didn’t take affect, the android-release-unsigned.apk file will be generated instead, indicating that the APK wasn’t signed. If this happens, try cleaning the build using cordova clean android, and trying again

Android, Code Signing, Cordova, Google Play Store, Security

2 comments on “Cordova: Release Signing Android Applications”

  1. Generate signed apk for android using Gradle for cordova 6.0.0+ in ionic – R & V Blog says:
    July 4, 2016 at 1:56 PM

    […] to thanks Niraj, as i got my task […]

    Reply
  2. Cordova: Changing the Default Debug Keystore for Android Applications | Web Niraj says:
    November 21, 2016 at 9:25 PM

    […] already covered release signing Android application in Cordova in a previous article, but sometimes you want to do the same for debug builds. By […]

    Reply

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

Support Me

Buy Me a Coffee

PSN Profile

Tags

ACL Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache Backup Bash Bug Command Line Cordova cPanel / WHM Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Flash Geolocation Google Nexus 5 Hacking HTML5 Input Sanitization iOS JavaScript jQuery Laravel 5 Laravel 5.2 Linux Mac OS NodeJS Parse PDF PHP Plugin Portfolio Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins
© 2011-2025 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Privacy Policy