To use Google Maps in Android using MapView Control we need Google Maps API Key. To get the key we have to go through the following steps.
- Locate debug.keystore file on your system.
- Locate keytool.exe file on your system
- Generate MD5 fingerprint.
- Use that MD5 fingerprint to get the Google Maps API Key
The debug.keystore file can be found at “c:\users\mir nauman tahir\.android\debug.keystore”
Replace “mir nauman tahir” with your current user name.
Now navigate to keytool.exe file. “c:\program files\java\jdk1.7.0_02\bin\keytool.exe”
Replace the jdk version with the version installed on your system.
Now execute the following command.
C:\Program Files\Java\jdk1.7.0_02\bin>keytool.exe -list -alias androiddebugkey -keystore “c:\users\mir nauman tahir\.android\debug.keystore” -storepass android -keypass android
If prompted for a password, try “changeit” or just press enter key to enter an empty password. This command will return SHA1 fingerprint. jdk1.7 or higher will return SHA1 by default. Remember the bold and italic text is the path to the debug.keystore file. You have to provide the path to debug.keystore file on your system. Secondly the path to the debug.keystore file must be enclosed in double quotes.
We don’t need SHA1. we need MD5 fingerprint so either we have to use jdk1.6 or we can use the following command to generate MD5 finger print using jdk.17.
C:\Program Files\Java\jdk1.7.0_02\bin>keytool.exe -v -list -alias androiddebugkey -keystore “c:\users\mir nauman tahir\.android\debug.keystore” -storepass android -keypass android
By putting a “-v” in the command it will generate the following output.
Copy the MD5 fingerprint. LogIn to your google account (even signing in to gmail will work). Than navigate to the following url http://code.google.com/android/maps-api-signup.html . Paste your MD5 fingerprint in field shown in the picture below and click generate api key.
When you click generate button you will be taken to another screen showing your MD5 fingerprint, your Google Maps API Key and how you can use it in your code to enable Google Maps in Android development.
Mission Accomplished.
Note:- Please leave your comments if this article was helpful.
If you can’t find debug.keystore file in “.android” folder than follow the link to solve that issue.
https://mirnauman.wordpress.com/2012/04/04/cant-find-debug-keystore-in-android-folder-issue-solved/
62 comments
Comments feed for this article
January 30, 2012 at 11:54 am
Using Google Maps in Android Development Tutorial Part 1. « Mir
[…] https://mirnauman.wordpress.com/2012/01/26/how-to-get-google-maps-api-key-for-android-issues-and-erro… […]
February 3, 2012 at 2:50 pm
Max
thank you vary much
February 13, 2012 at 6:18 am
Adding image to GoogleMaps using map overlays. Android tutorial Part 3 « Mir
[…] https://mirnauman.wordpress.com/2012/01/26/how-to-get-google-maps-api-key-for-android-issues-and-erro… […]
February 22, 2012 at 8:12 am
Chirs
Great work hey? It was a very easy to work through. Looking forward to building an android app.
April 4, 2012 at 10:49 am
Can’t find debug.keystore in .android folder. Issue Solved. « Mir
[…] https://mirnauman.wordpress.com/2012/01/26/how-to-get-google-maps-api-key-for-android-issues-and-erro… […]
April 21, 2012 at 7:00 am
ks
In very gread document for getting MD5…..thank u so much…….
May 9, 2012 at 3:54 am
Mir
Reblogged this on Mir.
May 26, 2012 at 8:12 am
jyo
thank you so much you saved plenty of time of mine..very good explanation
June 21, 2012 at 2:27 pm
ahsan
Thank you Mir…… i have done the code of map its working an mobile but not running in Emultor.. what will be the problem please tell me….
I will w8 4 your rly…
June 22, 2012 at 4:11 am
Mir
Dear ahsan,
plz check ur sdk version and google api version. provided that ur google maps api key is correct.
July 1, 2012 at 9:48 pm
Syed
Thanks a bunch.. you made it really easy.
July 7, 2012 at 7:30 pm
Romulo
Cara, tu é um genio, estou a horas com esse maldito problema com o md5. Muito obrigado.
Grande abraço.
July 9, 2012 at 12:25 pm
Mir
Dear romulo, i dont understand what u have commented. can u post your comments in English please.
July 26, 2012 at 10:27 am
bilal
dear mir my cmd gives an error keytool error: java.lang.exception:keystore file doesnot exist
July 27, 2012 at 3:40 am
Mir
dear bilal,
kindly go through the following article
hope it will solve the problem.
July 26, 2012 at 11:17 am
bilal
man i found the solution i wasnt in the administrator mode thanx anyways
August 24, 2012 at 11:43 am
Me
Worked as charm! 😉 thanks bro!
August 27, 2012 at 6:26 am
Mir
you are welcome. 🙂
September 1, 2012 at 1:53 pm
Helen
Thank you so much. Went through >100 posts everywhere -> map not showing in Google Maps example, Factory client error in Java, etc., turned out that I used a wrong debug.keystore.
Ps. Romulo says something like: what an annoying problem with md5. Thank you very much. Big hug
September 1, 2012 at 3:17 pm
Sergei
Helped to solve my problem of not being able to display Google map tiles. Before reading the article was using SHA1 to generate the key.
September 8, 2012 at 5:16 am
Krushnakant
Great work…buddy
September 19, 2012 at 11:10 am
uth
Thanx it was very helpfull :)))
October 8, 2012 at 9:45 pm
salamswati
Really helpful ..so simple tutorial.
thanks Nauman bhai
November 17, 2012 at 3:25 am
Alican Özgören
Thank you for the very informative article, it was very helpful.
November 27, 2012 at 1:01 pm
Durratulmazd Rokadia
hey buddy it is really simple effective and helpful …good work….thanx…keep going…
December 1, 2012 at 5:15 pm
LuisManuel
Thanks a lot, it worked fine. Easy and simple tutorial. My problem was thinking that Google Maps API Key for web browser would also work for Android.
December 2, 2012 at 5:51 am
Vishal
im facing this problem
The fingerprint that you entered is not valid.
plz help me
December 3, 2012 at 6:21 pm
Mir
u must be using SHA1 instead of MD5. check the tutorial again
December 4, 2012 at 12:08 pm
Vishal
C:\Program Files\Java\jdk1.6.0_19\bin>keytool.exe -list -ali
as androiddebugkey -keystore C:\Users\Vishal\.android\debug.
keystore -storepass android -keypass android
androiddebugkey, Dec 3, 2012, PrivateKeyEntry,
Certificate fingerprint (MD5): 75:1E:9E:28:**:**:**:**:**:**
:**:**:**:**:**:**
C:\Program Files\Java\jdk1.6.0_19\bin>
This is my MD5 key still im facing the same problem. plz hel me sir
January 28, 2013 at 1:22 pm
dyk
Thx! you r GOD! i wasted a lot of time before a read this!
January 28, 2013 at 1:45 pm
Mir
thanks for the compliment, but am not a GOD. i documented this coz i wasted a week on figuring this out. am glad its helping other too. thanks for liking my post.
February 6, 2013 at 7:13 am
Abdul
hey Mir…there is some problem.. when i am clicking on this http://code.google.com/android/maps-api-signup.html
it automatically transfers it to https://developers.google.com/maps/documentation/android/
and i m not able to get map key.. Plz help…
February 20, 2013 at 11:52 am
Mir
Dear Abdul,
i have checked wat u said. google has launched Google Maps API V2. i ll check how to coupe up with this. am a bit occupied these days but i will start working from scratch on API V2
May 6, 2013 at 11:45 am
Raghuram
when i clicking this link http://code.google.com/android/maps-api-signup.html
it automatically transfers it to https://developers.google.com/maps/documentation/android/
and i m not able to get map key.
please send the api genetation link to my mail id plz……….
(g.rahuram@gmail.com)
June 10, 2013 at 5:40 pm
mohamed dahab
here is the new page for getting google map api version 2 :
you just go to service , and all the the taps near to it
code.google.com/apis/console
May 6, 2013 at 11:43 am
Raghuram
hello abdul …
Do u find the solution of this problem please send me that link to my mail id (g.rahuram@gmail.com).
when i clicking this link http://code.google.com/android/maps-api-signup.html
it automatically transfers it to https://developers.google.com/maps/documentation/android/
and i m not able to get map key..
February 21, 2013 at 2:01 pm
greendog
With the new API v2 you need SHA1 fingerprint, MD5 is not longer possible.
And for generating SHA1 fingerprint is Java 1.7 needed.
February 21, 2013 at 8:01 pm
shopperpress
Good day very cool blog!! Man .. Excellent .. Superb .
. I will bookmark your site and take the
feeds additionally? I’m happy to search out so many useful information right here within the post, we need work out extra strategies in this regard, thank you for sharing. . . . . .
February 22, 2013 at 3:05 pm
Apriandana D.Pribadi (@iluz7)
I’ve been done all the following steps but unfortunately the result is
keytool error: java.lang.RuntimeException: Usage error, and is not a legal command , what’s wrong with it ? I use java 1.6 , thanks 🙂
February 26, 2013 at 8:12 am
Mir
use java 1.7 as i have written the tutorials with 1.7. follow the following tutorial
it might solve ur issue with keytool
March 15, 2013 at 4:57 am
Durgarao
Hi it is very helpfull to generate md5 api key
Good
Thanks sir
March 21, 2013 at 8:22 am
Mahesha
Thanks for your helpful steps….
March 24, 2013 at 7:53 pm
Maimoonah
Thanks..
It’s good to add search box for this website
April 15, 2013 at 2:52 pm
sultan
now plz send latest procedure becuase this websites change when i click ur given link it go somwhere else
plz anybody help
April 26, 2013 at 5:41 am
lalitkumar
hey Mir I have generate the API key but it is not Showing map when i published the app in google play
May 6, 2013 at 10:36 am
Mir
the aps developed with google maps api ver 1.0 will not work with google maps api ver 2.0.
Google Play has ver 2.0. you need to develop ur app for 2.0.
June 11, 2013 at 5:06 pm
Mir
Dear lalit,
Follow my latest series of articles. That will solve ur issues.
May 6, 2013 at 9:32 am
Andrew
thanks for your helpful guide however i get error message which states ” The file name, directory or volume label syntax is incorrect. when i type “C:\Program Files\Java\jre7\bin\keytool.exe” -v -list -alias androiddebugkey -keystore “C:\Users\Atwine\.android\debug.keystore” -storepass android -keypass android
May 6, 2013 at 10:34 am
Mir
update your JRE. than check the bin folder manually. does it have the keytool.exe file. than check the android folder in ur urser folder to see if there is any debug.keystore. if everything is in place than run the command again. it will work. if not check ur command specially the paths. there must be something wrong there.
May 10, 2013 at 7:57 am
Rajeev Ranjan
Sir I am using ur this tutorial to use google map in my app, but when I use MD5 fingerprint then google api console say Invalid Input, but when I use SHA1, it generates apikey, and I am using this generated api key in my app,But only grid is displaying without map.Error is coming like- Couldn’t get connection factory client.
Plz help me Sir…..
May 14, 2013 at 11:06 am
Mir
this could be a problem of a wrong api key. or the permissions. are u using google maps api 1 or 2.
May 27, 2013 at 11:35 am
mohamed dahab
hi sir ,, same problem , please reply
June 10, 2013 at 5:41 pm
mohamed dahab
here is the site chose service :
code.google.com/apis/console
June 18, 2013 at 11:13 am
Our First Android Google Maps API Ver 2.0 Application. Getting the Android Google Maps Api Ver 2.0 Key. Part # 2 | Mir
[…] the SHA-1 fingerprint through command prompt. The command is explained in detail in the link How to get Google Maps API Key but there is a simple way to find out SHA-1 fingerprint but before we get this fingerprint we need […]
July 4, 2013 at 10:45 am
mayank
please give me full code of Google MAP API V2
here, i have created one application n i used Google Map API V1
so, now i want to update Google Map Api v2
so please help us. we need full source code in Google Map Api v2
please help us : mayank.langalia@live.com
July 9, 2013 at 7:51 am
Mir
Check the link at the bottom of the article, download link for the source code is available.
July 8, 2013 at 11:00 pm
Goolgle maps isnt loading a map in my app - Tech Forum Network
[…] The problem is that the map doesn’t load in it just shows a grid of grey rectangles. I can’t see any errors myself but I don’t where to look. I have generated the API key for google maps for my certificate and by debug keystore as countless tutorials and topics on here suggest. Link 1 […]
July 9, 2013 at 7:54 am
Mir
the prievious version of android google maps had some issues. they can be solved if you follow the tutorial of android google maps api ver 2.0
this has step by step solution to everything.
July 19, 2013 at 6:48 pm
Nilton Castro
Hi Mir, you are a very decent guy, thank you very much!
November 8, 2013 at 5:43 am
Heather
“How to get Google Maps API Key for Android. Issues and Errors Solved.
| Mir” genuinely got myself simply hooked on ur blog! I actuallywill certainly be returning way more regularly.
With thanks ,Mel
September 28, 2014 at 10:31 am
priya chaursia
when i right this command on cmd C:\Program Files\Java\jdk1.7.0\bin>keytool.exe -v -list -alias androiddebugkey -keystore “c:\users\PRIYA\.android\debug.keystore” -storepass android -keypass android
it show me access is denied. plz help me
September 29, 2014 at 5:02 am
Mir
Hello priya,
you have to log in as Admin. Also check the folder if its not read only.