Creating an APK File

When you build your app in Release mode (either from Visual Studio or by using the Cordova CLI build command with the –release directive), android-release-unsigned.apk file is created in the /platforms/android/build/outputs/apk directory.This is the package for your app, which has not yet been signed with a certificate. The app is signed using tools supplied by Java.

Perform the following steps to obtain an app signed with a certificate:

  1. Run the keytool utility with the following command:

    $ keytool -genkey -v -keystore <keystore name>  -alias <alias name> -keyalg RSA -keysize 2048 -validity 10000

    where, <alias name> is the alias name for the application and <keystore name> is the name for the Keystore file that you want to create; the recommended extension for the Keystore file is .keystore.

    Notes:

    • The keytool utility ships with the Java Development Kit and can be found in the bin folder (for example: C:\Program Files\Java\jdk\bin\keytool,exe).

    • Ensure that the Java JDK bin folder is in your PATH variable.

  2. Type the password and required user details when prompted.

  3. Type yes to confirm the details that you have provided.

  4. Type an alias password, which can be different from the Keystore password, and then confirm this password.

    The Keystore file is then created in your system.

  5. After creating the Keystore file, to sign the app package (.apk file), run the jarsigner.exe utility (ships with Java Development Kit and resides in the bin directory) with following command:

    "<Installed JDK location>\bin\jarsigner.exe" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystore name>  <app name> <alias name>

    For example:

    "C:\Program Files\Java\jdk1.8.0\bin\jarsigner.exe" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myKeystore.keystore myApp.apk myAliasName
  6. Once the app package is successfully signed, use the ZipAlign tool from the Android SDK directory to prepare the application for release. Use the following command:

    "<Installed Android SDK Location>\build-tools\<sdk version>\zipalign" -v 4 <input app file name>  <output app file name> 

    For example:

    "C:\Users\John\AppData\Local\Android\sdk\build-tools\27.0.1\zipalign" -v 4 mySignedApp.apk myAppForPublishing.apk

Your app is ready to be published on the Google Play store by using the Google Developer Console.

It also requires a review process, however the turnaround is much faster than from the Apple Store. Typically, your app will be available for download on Google Play within a few hours.