Guide: Google Maps V2 for Android : Getting the API key

Since I have been working on an Android application that uses Google map
services I have decided to write a couple of posts on this topic.
The application will be posted here as well in the near future.

The first thing you have to know when implementing Google Maps for android is
that you have to produce your own Google Map Android API V2 key.
Now there is a reason that I’m marking this name, take a careful look that you turning on
the right Key in you API Console and that you have chosen the API for Android
and not the Google Maps API V2 or V3 for example.

So how do we get an API key, you ask? Well it’s a few steps task:
1. First of all we need to find our SHA1 key. For debugging
purposes we will use the debug.keystore file to get our SHA1 key. to do that
we will use a tool named ‘Keytool‘ that come with Java installation.
so open you command prompt, head to the following location:

C:\Program Files\Java\<your JDK or JRE instllation>\bin>

and run the next command:

keytool -list -v -keystore C:\Users\<your user name>\.android\debug.keystore -storepass android -keypass android

You will recive the following output:

SHA1 key pic
Copy the SHA1 key by right-clicking the command prompt choosing ‘Mark’, then
mark the all key and right-click again on the marked text to copy it.

2. Now that we have the SHA1 key we can head to the Google API’s Console,
sign-in with our Google account and create a new project by clicking the drop box
in the upper-left corner of the screen and choosing the ‘Create…’ option:

create in google api

Give a name to your project and create it.

3. Once you have done that head to the Services section and turn on the Google Map Android API V2:

api service

4. Now open the API Access section and press the Create new Android key… button.

In the window that opens you will have to enter you SHA1 key you got in the 1. section adding
to it your application package name after a semicolon as in the example:


After pressing the Create button you will recieve you own Google Maps API V2 key for Android.

My next post will explain how to use this key to create a Google map in your application.

36 Responses to this entry

  • susan Says:

    This is a brilliantly clear explanation of the how to get the Google API key stuff sorted – Every step clearly explained. Thank you Emil!

    Posted on April 12th, 2013 at 2:25 pm Reply | Quote
  • Emil Adjiev Says:

    You are welcome @susan, I’m glad it helped you : )

    Posted on April 12th, 2013 at 3:57 pm Reply | Quote
  • suresh Says:


    i follow all step care fully but my background only not load, but it show location by Latitude and Longitude value and pin, please help me out from this issue. am not using debug key store used signed application key store


    Posted on April 27th, 2013 at 5:12 pm Reply | Quote
  • Emil Adjiev Says:

    @suresh please check the following answer: How to create release key for android v2 maps?

    Posted on May 4th, 2013 at 8:30 pm Reply | Quote
  • rameez Says:

    hey in step 3 do we put this:

    or should we put :


    Posted on May 10th, 2013 at 4:19 pm Reply | Quote
  • Emil Adjiev Says:

    @rameez it the second option, your project name should be included as well.

    Posted on May 10th, 2013 at 9:19 pm Reply | Quote
  • Shine Says:


    Brilliant blog !!!…
    U saved my time; thanks a lot.


    Posted on May 18th, 2013 at 4:32 pm Reply | Quote
  • Emil Adjiev Says:

    @Shine you welcome, I’m glad you found it useful: )

    Posted on May 18th, 2013 at 9:59 pm Reply | Quote
  • Patrick Says:

    A lot of sites failed to explained this as clear as it is on your blog. I was about to give up on Google Maps v2 until I read this.

    Posted on May 21st, 2013 at 2:52 pm Reply | Quote
  • Emil Adjiev Says:

    @Patrick I’m glad it was useful to you. stay tuned for more posts regarding Google Maps API V2.

    Posted on May 21st, 2013 at 3:04 pm Reply | Quote
  • Roberto Allende Says:

    Great Post!, very clear, you’ve saved my day!

    Posted on May 23rd, 2013 at 11:26 pm Reply | Quote
  • Abhijeet Says:

    what is the application name after semicolon after SHA1?
    i tried com.gpsfare.activities and it did not work

    Posted on June 1st, 2013 at 10:37 am Reply | Quote
  • Emil Adjiev Says:

    @Abhijeet “com.gpsfare.activities” is wrong, you should add there the full package name of your application that you can get from the manifest file under the package tag.

    Posted on June 2nd, 2013 at 12:17 pm Reply | Quote
  • Ashana Says:

    Hy,first thanks for the nice tutorial and wish u all the best for your future sessions.question is,should we have to generate API(Google) keys separately for every single application that we use Google maps?

    Posted on June 11th, 2013 at 12:08 pm Reply | Quote
  • Emil Adjiev Says:

    @Ashana Hi, Yes indeed you have to generate a separate key for each of your applications.

    Posted on June 11th, 2013 at 1:45 pm Reply | Quote
  • jose Says:

    I can’t see the maps in my android. I see a gray grid whit the buttoms for zoom.
    You can help me with this problem.

    Posted on June 22nd, 2013 at 12:50 am Reply | Quote
  • Guy Says:

    Did it all but my .android folder is under the android sdk folder… I had .android folder under my user’s folder but I deleted it for some unclear reason… HELP I allways get:
    06-23 20:04:30.011: E/Google Maps Android API(6623): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).

    Posted on June 23rd, 2013 at 8:47 pm Reply | Quote
  • Emil Adjiev Says:

    @jose I can’t help you without seeing your logcat output, and your code. You are welcome to post a question on SO and post here a link and I will try to help you.

    Posted on June 24th, 2013 at 10:01 am Reply | Quote
  • Emil Adjiev Says:

    @Guy you can try to delete the .android folder from it’s correct location and compile any project in your eclipse work environment, this should regenerate a new key and a new folder. check were it’s created. and get the key from there. Register it against the Google API Console and let me know what is the result of this operation.

    Posted on June 24th, 2013 at 10:05 am Reply | Quote
  • Ziro Says:

    Good Post..
    you saved my project..


    Posted on July 26th, 2013 at 6:30 am Reply | Quote
  • viljar Says:

    Very good post, thanks a lot!

    Posted on July 31st, 2013 at 6:37 pm Reply | Quote
  • Emil Adjiev Says:

    @Ziro and @Viljar you welcome, have a nice coding.

    Posted on July 31st, 2013 at 7:02 pm Reply | Quote
  • Keerthi Says:

    Thank u. It was the tip #3 that prevents my application running. (3. Once you have done that head to the Services section and turn on the Google Map Android API V2). Thanks again. :)

    Posted on August 3rd, 2013 at 3:51 am Reply | Quote
  • hamid Says:

    i am using my phone to debug my program, i just did all these steps and update the last version of google play service but when i open my file on the phone it is just a white space , it seems that the map is not loading, because everything else is loading(like + and – button) and name of the app, but the map is not loading, can you help me?

    Posted on August 3rd, 2013 at 10:51 pm Reply | Quote
  • Emil Adjiev Says:

    @hamid this willl usually indicate that you have some problem with the way you have produced your key or the way you registered it in the API Console. You can try to redo this guide all over again, and make sure you have made all the steps correctly. You can try to remove the debug.keystore folder and to compile a project in Eclipse, this will result in a new SHA1 fingerprint that you should then register via the API Console again.

    Posted on August 4th, 2013 at 10:56 am Reply | Quote
  • mike Says:

    hey Emil thanks for the post please i am working on a project that involves maps and i am new to android i wanted to know whether in eclipse when you click under
    Windows>Preferences >Android >
    I get the SHA1 and MD5 fingerprint so do i need to still generate another SHA1 to apply for the MAP API……..Please help i don’t really get it

    I am working with maps and i have added Google play store libraries and immediately i add them i get a green mark but once i close the dialog window and check under Project Libraries i can see them but with a red mark is that normal…………!!!!

    Posted on November 11th, 2013 at 1:33 pm Reply | Quote
  • Emil Adjiev Says:

    @mike Hey, I didn’t really understand the first part of the question, there is no connection between the “Windows>Preferences >Android >” window and your SHA1 fingerprint, You need to follow the guide to get it.

    Now for you second problem, no I’t not normal and it should stay as a green V, for fixing this problem you can try:
    1. Re-download the google-play-service library again from the SDK Manager.
    2. Try to move the downloaded library to a different location in your computer where it path would be shorter,
    this helped me once in the same problem.

    Posted on November 12th, 2013 at 7:36 pm Reply | Quote
  • Edzel Says:

    Thanks a lot! :D I will visit this blog all the time especially the android google map related topics.

    Posted on November 20th, 2013 at 8:49 am Reply | Quote
  • Emil Adjiev Says:

    @Edzel You welcome, I’m glad it was useful to you : )

    Posted on November 20th, 2013 at 4:30 pm Reply | Quote
  • Memeh Says:

    Thank you very much..!
    Really helped me out…

    Nice Post..! Keep up..! xD

    Posted on November 25th, 2013 at 1:00 am Reply | Quote
  • gaztesk Says:

    Simply lifesafer!!
    Thank you very much!!

    Posted on December 27th, 2013 at 10:03 am Reply | Quote
  • Gennady Says:

    Thanks so much! You really helped me. Thanks for this blog!

    Posted on February 8th, 2014 at 5:14 pm Reply | Quote
  • Emil Adjiev Says:

    @Memeh, @Gaztesk , @Gennady you welcome guys, glad this post was helpful for you : )

    Posted on February 9th, 2014 at 5:31 pm Reply | Quote
  • Hetash Patel Says:

    I am trying to run my code on my android device HTC desire SV.But it is showing blank map with zoom in and zoom out buttons.I have added reference to google play services support libtaries(Version 4).I have generated map key from SHA1 key using google’s API cosole but still it is showing blank map.
    pls help me

    Posted on February 21st, 2014 at 2:55 pm Reply | Quote
  • Emil Adjiev Says:

    @Hetash Patel You can try to remove the debug.keystore from your computer and compile your project to generate a new keystore. then follow all the steps again. make sure that you are turning the right API in the API Console.

    Posted on February 25th, 2014 at 12:39 pm Reply | Quote
  • Enrique Says:

    Thanks from Arequipa! :)

    Posted on October 26th, 2014 at 7:04 pm Reply | Quote

Leave a comment