Signing a Cordova App with a Cup of Coffee

The first time I built a Cordova Andriod app, it was hell getting it signed and i couldn’t upload for days. That is what inspired this post to help you avoid such fate.
I successfully found a way to sign my Cordova Android App and Upload it to Google Play Store for download and here is the solution.

Here’s What we are to cover.

1.Generate a release build for Android.

2.Generate Keystore.

3. Sign the unsigned APK.

4. Run the zip align tool to optimize the APK.

Grab some popcorn and a cup of coffee

So let start…

I assume you are familiar with Cordova CLI command tools if not go and learn it first unless this may look like mandarin to you.

Step 1. To generate a release build for our cordova android App, we first need to make a small change to the AndroidManifest.xml file found in platforms/android. Edit the file and change the line:

<application android:debuggable=”true” android:hardwareAccelerated=”true” android:icon=”@drawable/icon” android:label=”@string/app_name”>
and change android:debuggable to “false”:

<application android:debuggable=”false” android:hardwareAccelerated=”true” android:icon=”@drawable/icon” android:label=”@string/app_name”>
Note: For cordova 6.2.0 remove the android:debuggable tag completely.

Here is the explanation from Cordova as to why:

Explanation for issues of type “HardcodedDebugMode”: It’s best to leave out the android:debuggable attribute from the manifest. If you do, then the tools will automatically insert android:debuggable=true when building an APK to debug on an emulator or device. And when you perform a release build, such as Exporting APK, it will automatically set it to false.

Read more…