Steps to Create an Android Certificate Without Pulling Out Your Hair

I have seen a ridiculous number of useless tutorials on how to create an Android keystore/certificate to be used for sigining Android apps that I decided I needed to write one that is actually useful.  First of all, the example provided by Phonegap Build and others doesn’t work with more recent versions of the java keytool and I guess they gave up on updating their docs (probably because of the impossible task of maintaining what Oracle is updating).  My guess is that you already have found that out and that is why you are here checking out this tutorial.  Apple has a nice GUI interface to use for generating iOS certs (the down side is you have to have a MAC) and now you can use a GUI tool on your PC as well to generate your Android keystore!  You are about to find out how!

The first thing we are going to do is install a free application called Keystore Explorer from here: http://keystore-explorer.sourceforge.net/  Once you have done that you are ready to open it up and create a new keystore choosing the following:

android-cert1

We are trying to create a Java Keystore (JKS).
Now we need to generate a keypair:

android-cert2

We want a 2,048 RSA key (which should be the default)

android-cert3

It’s important to note that we need to have a key for Google Play that has an expiration date AFTER October 22, 2033 (yeah who knows why) so just choose 25 years from now.

android-cert4

We do have to add our name and a little information about ourselves here:

android-cert5

Here is what that might look like:

android-cert6

You should be able to use the default alias

android-cert7

Okay you did it! Now you just have to save your keystore and get ready to use it in your build environment (for me that is PhoneGap Build).  When you save the keystore using Keystore Explorer be sure to save it with the .keystore extension (PhoneGap won’t accept the keystore otherwise).

I hope this helps make the process easier for you.  If you are like me you spend most of your time programming and you just don’t commit the signing stuff to memory (mostly because it’s mildly annoying).  Hopefully this tutorial will make it a little less annoying for you and allow you to get back to focusing on your code.