Friday, February 26, 2010

Sign your Android applications for release

The process of application signing can be very confusing for new developers. But, once you have done it 2-3 times, it will be more like a chore for you after that. It's not very complicated at all. So, here are the steps that you need to follow.

Note: If you already have a self-signed certificate/keystore, skip to step 2(b):

Step 1: Right click on the Android project. From the context menu, select, Android Tools -> Export Signed application package. In the dialog that will open, you will see the name of your project. If you have selected the wrong project, here is a chance to correct yourself. Click on "Next".


Step 2:  The next screen is the most complicated screen that you will get in this process. Here, you can have two situations.

a. If you don't have a keystore already, you will need to create one first. Once created, you should preserve this keystore somewhere, safely, so that you don't accidentally delete it. You will need this keystore everytime you want to sign and update your application to the Android Market. Please, please, please, DO NOT LOSE THIS KEYSTORE.


Since, we are creating a new keystore this time, select the second radio, and browse to a location where you want you new keystore to be saved. Enter and confirm a password. Remember this password. Click on "Next".

Enter all the fields in this screen and press enter. Now your keystore will be created. Please rememeber all your passwords. Else, this keystore will be useless for you later.For simplicity, keep both the passwords same.

On this screen, specify a name and location of the apk and click on "Finish". Your signed application package will be created for you in the location you have mentioned here. You can now take this apk and directly upload it to the Android market, or put it on your phone.
b. When you already have a kestore, it's more easier to sign your application. On the second screen, select, "Use existing keystore". Enter the location of the keystore and password. Click on "Next". On the next screen, select you alias from the drop down, enter the alias password, click on "Next". On the next screen, specify a name and location where you want the apk to be created and click "Finish". You are done now.

Isn't it simple? Just one point to note: If you are using an old ADT version, this option of signing your apps from eclipse might now be there. In such a case, you will have to do it through command line. You can find many tutorials on how to achieve that.