To access APIs in Android from Google API console you need to generate an API Key. This same API key can me used for accessing multiple APIs under the same project. To generate an API key you require, SHA1 fingerprint of your keystore. Keystore is basically a place where the private keys for your app are kept. In simple words its a certificate generated by user or a program, used for signing an Android app.
In android there are two types of keystores. A debug keystore, and a release keystore. Debug keystore is generated automatically when the Android SDK is installed or run for the first time. Release keystore has to be generated manually by the user for each application before release. As it requires private information such as name, password etc. To obtain an Android SHA1 fingerprint from your desired keystore, please follow the steps below:
1) Getting Android Debug Keystore SHA1 Fingerprint:
The hard way:
- Open a terminal window.
- Change the directory to the JDK bin directory, mine was jdk1.7.0_05 (could be different for you).
cd C:\Program Files\Java\jdk1.7.0_05\bin
- Next we have to run the keytool.exe. Use the following line to get the Android SHA1 fingerprint.
Windows:keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Mac and Linux:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
The easy way (Only for Eclipse IDE):
- Open Preferences by Navigating to
Window
->Preferences
. - Select
Android
->Build
.
2) Getting Android Release Keystore SHA1 Fingerprint:
To find out the Android SHA1 fingerprint for release keystore, follow these steps:
- Open terminal
- Change the directory to the JDK bin directory, mine was jdk1.7.0_05 (could be different for you).
cd C:\Program Files\Java\jdk1.7.0_05\bin
- Next we have to run the keytool.exe. Use the following line to get the SHA1 fingerprint.
keytool -list -v -keystore {keystore_name} -alias {alias_name}
Example:
keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test
It will prompt for a password.
- Enter the password, you will get the SHA1 and MD5 fingerprint.
Extracting the SHA1 fingerprint from an Android keystore cannot be simpler than this. Above steps can be used on Windows, Mac and on Linux machines.
Born in New Delhi, India. A software engineer by profession, an android enthusiast and an evangelist. My motive here is to create a group of skilled developers, who can develop something new and good. Reason being programming is my passion, and also it feels good to make a device do something you want. In a very short span of time professionally I have worked with many tech firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, and whenever I get spare time I share my thoughts here at Truiton.
Nice explaination
Thank You Very Mush..,
It’s error when my keystore alias contain of more than 1 word.
Hi Mohit,
I find your tutorials really helpful, thanks a lot for the content , a lot of my doubts are solved after reading this blog.
Have a good day .
Shreyasta
I’ve had to find my SHA1 fingerprint several times recently and this guide has been absolutely invaluable in making a previously bizarrely frustrating process much much easier. Thank you!
thanks
Thanks, this works:)
Thanks bro
Exactly what I was looking for…Thanks a ton!!
thanks!
The first step worked for me. Can i use the same fingerr print in all my apps?
Yes. Debug keystore would be same for all your apps.
Thank you, it helped me a lot 🙂
Thanks a lot. Searched a lot for the correct solution. This article finally helped.
Thank you very much for this tutorial.
You really help me to get this SHA 1. i confuse to get SHA 1 certificate fingerprint for my android app
Hazom Tutorial Thank you verymuch
Thank you so much
Thanks