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.


Thanks,
Kumar


 

22 comments:

  1. Great work. It is really a good tutorial for newbies.

    ReplyDelete
  2. Thank you for this, total newb here, you explained it well.

    ReplyDelete
  3. I was totally lost on the whole concept of creating a keystore and you talked me through it. Thanks, man.

    ReplyDelete
  4. Thank you for this post!

    ReplyDelete
  5. Great! Sometimes We can get exactly what we want.

    This is good example

    8 days google search how to release my android app!!

    Finally !!!!

    Too much ants tutorial .. too much...

    Thanks and thanks again

    ReplyDelete
  6. Handy and Helpful post..Thnk u Boss

    ReplyDelete
  7. Why 2 passwords?
    The 1st one can be reused again and again for all my apps?
    Or it's just for this 1 app?

    The 2nd is only for creating (and later updating) this *ONE* app? Or do I use it for all my other apps too?

    Ugh.

    All the info giving for all that is just "enter your password".

    Ugh.

    ReplyDelete
    Replies
    1. Well, You could have both the passwords the same. One is the keystore's password and the other is the alias's password.

      Yes, you can re-use the passwords for all your apps.

      Delete
  8. Thank you for this Great Post.

    ReplyDelete
  9. Just exported my first app thanks

    ReplyDelete
  10. Brilliant tutorial thanks, one question once I have packaged the app how do I get it to my device and install it?

    ReplyDelete
  11. Hi Kumar,

    excellent tutorial thanks ,

    i have successfully done my .keystore on mac. now i want to get keyhash from that .keystore file
    how can i achieve that. please help me to get out of this

    anyone's help will be appreciated.

    thanks in advance.

    ReplyDelete
  12. Quick tip: if you've been debugging with eclipse on your android device (ie installing from eclipse), and now you're trying to install an APK of your app on your android device, and it's failing to install (with the error "Signature Mismatch" in the device log), make sure you've deleted your debug version off your device completely before trying to install the APK.

    Took me a little while - about half an hour - to work it out, but I've got a feeling it could be one of those winkles that might have taken a week of head-banging frustration to fix if I wasn't lucky.

    ReplyDelete
  13. Hi,
    Using this tutorial I tried to get MD5 fingerprint certificate but once I give everything in command line it produce me only the SHA fingerprint with the help of this key I tried to get google map API key it said like the fingerprint which you gave is not valid. I don't know what to do, please help me how to get solution for this. Thanks in advance..

    ReplyDelete
  14. Hi,
    I tried with this whole tutorial but finally I got my SHA fingerprint certificate and not MD5 certificate, then I tried to get the Google map API key using SHA private key it replied me like the key which you submitted is invalid. But I give all things correctly in my command line tool while executing. I don't know what to do as of now. Please help me asap.

    ReplyDelete
  15. Exactly what I needed, thank you very much!

    ReplyDelete
  16. Brilliant! thanks :)

    ReplyDelete
  17. Tanks I'm new android developer

    ReplyDelete
  18. very good description for button-pressers like me! thanks!

    ReplyDelete