Jan 012013

This tutorial explains how to generate a key for  your Android application.

People regularly ask me how to generate a key for your Android application so I thought I’d give a quick run through of the process.

*NOTE: This is a key for building apps for the Android Market/Google Play. For testing, you can use the debug key you already have.

**This is written for Mac users and I don’t currently have access to a PC but I believe the same commands in the terminal apply there too. If anyone could confirm that would be great!

Step 1 ) Open the terminal.

Step 2 ) Type in keytool -genkey -v -keystore yourappname.keystore -alias appnamealias -keyalg RSA -keysize 2048 -validity 10000

Changing the parts I have bolded into your own information.

Then hit enter.

Step 3 ) You will be asked for a password; don’t use anything you will forget and if you really need to, write it down. If you lose the password you wont be able to update your application in the future.

Step 4 ) You will asked to re-enter you password, do so, then hit enter again.

Step 5 ) You’ll be asked for your first and last names, key those in, hit enter again.

Step 6 ) You’ll be asked for the name of your “organizational unit” – I would use Techority for mine – you would likely use your studio name or, if you don’t have any alternatives, your own full name. (I guess this would really be more suited to entering a division within a company, like “marketing” or “sales”, but I wouldn’t remember that.) Enter again.

Step 6 ) You’re asked for the name your organization, I would again use Techority and you would do as you’ve done above. (Studio name or full name.)

Step 7 ) You’ll be asked for your “city of locality”, so you’d enter your city name. (Sydney, London, San Francisco, etc.)

Step 8 ) You’ll be asked for your “state or province”, so you’d enter the name of your state. (New South Wales, California, Florida, etc.)

Step 9 ) More location questions, you will need to key in the two letter code for your country. The United States is of course “US”, Australia for me was “AU”.

Step 10 ) Finally, you will be asked to confirm all is correct and then enter your password once more, which will be the same as the one you entered and reentered in steps 3 and 4.

Step 11 ) The .keystore file has been created! You can find it by clicking on the magnifying glass in the top right and doing a quick search for .keystore – move it to a safe folder you have created and be sure to back that up immediately.

And that’s it!

You can now build your Android app for the market using your newly generated keystore :)

I hope you will find this useful and it might make the process a little less daunting the first time around.

I’d like to say thanks to Joe of Fire Maple Games as he was the one to originally teach me how to do this.

Peach Pellen :)


Like this post? Subscribe to the monthly newsletter!


  3 Responses to “How To Generate A Key For Your Android App on a Mac”

  1. Thanks! I had notes on how to do that on my hard drive, and then could NOT find them tonight. So your instructions came in really handy! :)


  2. Hey Peach,

    The commands apply to any OS really. The only thing you need is the keytool executable which comes with any JDK – http://docs.oracle.com/javase/1.5.0/docs/tooldocs/.

    You can also add the -dname “SOME_LDAP_TYPE_NAME” command line argument to avoid steps 5-9. An example of the LDAP Type name is – “CN=Awesome Application,O=Awesome Game Company Name,C=US”

    Also note that validity is for the number of days the certificate you generate is valid for (from the date of generation), which 10000 ~= 27 years. Might want to play around with validity to see what happens to an app that doesn’t have a valid certificate (might be a good way to deploy beta versions of the APK to testers that have a cert that expires after 30 – 60 days or so.

    • Thanks Tyraziel – very useful info there!

      I do so little with Android for distribution that I am not up on all the finer points so I really do appreciate you sharing some of them, great stuff :)

      Just saw your FB message, will check it out now.

Leave a Reply to J. A. Whye Cancel reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.