Dieser Artikel wurde - im Gegensatz zu den meisten Artikeln meines Blogs - in Englisch verfasst.
Einer der Gründe dafür könnte sein, dass es sich um einen technischen Artikel handelt, der in englischer Sprache einem breiteren Publikum helfen kann.

Apache Cordova: Create a signed release APK – Easy HowTo

To upload an app to the Google Play Store, you need to sign it first.

There are a lot of tutorials out there, some of which are simply overwhelming, to say the least.


Here is my very simple solution to create a signed APK which you can upload to the Play Store.

Hate reading? The tl;dr version is at the bottom of the page.

To make it clear: This has been tested with Apache Cordova version 7.0.1.
To check which version of Cordova you are using, run this on your console.

Step 1: Create a keystore file

First: Navigate to your app’s root folder. Then you run the following command, after editing it to suit you environment.

Here, you will create a keystore file for your project. This file is needed to sign the APK. Simply change the Keystore filename to something you like, and do the same with the alias at the end of the comand.

After hitting enter, you will be presented with a few questions which you need to answer.

After you are done with this, the keystore file will be created in your app’s root directory. Simple move it to the platforms/android  directory.

Caution

If you do not create the keystore file, your build will crash with the following error message:

Step 2: Create release-signing.properties file

Create a file in your platforms/android/  directory with the name release-signing.properties .

Put the following content into the file

Rename the properties with the ones you provided during your keystore file generation and save the file.

Step 3: Run cordova build

To create your signed APK file, simply run the following command (still in your app’s root directory)

Now Cordova will use your release-signing.properties  file and create a signed APK without any hassle.

After the process has finished, you should be presented with something like this:

tl;dr : Breaking it down – all in one

Here’s the tl;dr for all the people who don’t want to read all this stuff above.
Replace the options with your own.

  1. keytool -genkey -v -keystore MyApp.keystore -alias myapp
  2. mv MyApp.keystore platforms/android
  3. Create the file  platforms/android/release-signing.properties
  4. Insert the following and replace the bold formatted properties with your own
  5. cordova build android --release

You’re done :)

Got something to add?

Let me know in the comments :)

Veröffentlicht von

Christian Hänsel

Web-Entwickler, SEO-Experte. Ich liebe technisches SEO, die Entwicklung von neuen Ideen und alles rund um das Internet... ja, ich habe mein Hobby zum Beruf gemacht und gehe auch Montags gerne zur Arbeit.

Kommentar verfassen