Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHarry James
14,780 Points[Guide] Getting SHA1 key for a Windows System
Getting your SHA1 key is a little more complicated on a Windows system so, follow along with my steps here:
1) Open Command Prompt by pressing Start+R and typing cmd.exe
.
2) Using Windows Explorer, find where your JDK directory is located (Usually Program Files >> Java) and copy the path.
3) In Command Prompt, type cd
followed by the directory of your JDK’s bin directory. e.g: cd C:\Program Files\Java\jdk1.8.0_25\bin
is the command I use (Yours may vary).
4) Using Windows Explorer, find where your .android directory is located (Usually under Users >> [YOUR WINDOWS USERNAME]) and copy the path.
5) Now, use this command below:
keytool -exportcert -alias androiddebugkey -keystore [PATH_TO_.ANDROID_DIRECTORY] -list -v
Replacing [PATH_TO_.ANDROID_DIRECTORY]
with the path you copied. Note that you should be running this command in terminal/command prompt in your JDK’s bin directory (You did this in Step 3).
You should then be prompted with the password as normal which you can enter (The password is android
) . After that, you’ll see the list of certificates printed to the screen. You want the SHA1 key.
In Command Prompt, it’s a little more tricky to copy the result so, to do that, follow these instructions:
1) Right-click on the Command Prompt.
2) Select Mark.
3) Highlight the SHA1 key.
4) Right-click again and the text will then be copied to your clipboard. You can now enter this on the Google Developer’s Console.
Hope it helps and if you have any problems with this, give me a shout and I'll be happy to help out :)
Jacob Bergdahl
29,119 PointsNever mind, I managed to get the key now, I accidentally used / rather than \, which apparently helped (oddly enough, since it found it both times). A warning came up that said that the keystore hasn't been verified due to the lack of password, but nonetheless I found and copied the SHA1 key.
Thanks a lot for posting this!
Harry James
14,780 PointsAwesome. Glad to hear you got it sorted in the end then :)
And thanks for the kudos :D Appreciate it!
jenyufu
3,311 PointsI'm stuck, I got to the
C:\Program Files\Java\jdk1.8.0_51> Part in the command prompt
but when I put in
keytool -exportcert -alias androiddebugkey -keystore \Users\Fu\.android.debug.keystore -list -v
I get an error: 'keytool' is not recognized as an internal or external command, operable program or batch file.
Harry James
14,780 PointsHey jenyufu!
You also need to go into the bin directory, so in your case, type:
cd C:\Program Files\Java\jdk1.8.0_51\bin
Then try using the keytool :)
Let me know how it goes!
jenyufu
3,311 PointsHarry James I did that, which is why command prompt showed: C:\Program Files\Java\jdk1.8.0_51>
but when I put in the keytool line, it still says keytool is not recognized as an internal or external command
Harry James
14,780 PointsHey again jenyufu!
When the console shows C:\Program Files\Java\jdk1.8.0_51>, type cd bin
.
Then, the console should show C:\Program Files\Java\jdk1.8.0_51\bin> and you should be able to use the keytool (Notice the bin directory on the end).
Let me know how it goes or if you're still having any problems :)
Pablo Rocha
10,142 PointsI want to point out that the default password is "android" without the quotes.
Also, since people seem to be having trouble, here is an example of what the command line can look like in step 5, different username of course.
After hitting the Enter key you should be prompted for the password. Just type the password, you may not see visual confirmation in the command window that you are actually type anything.
C:\Program Files\Java\jdk1.8.0_25\bin>keytool -exportcert -alias androiddebugkey -keystore C:\Users\Pablo\.android\debug.keystore -list -v
Harry James
14,780 PointsThanks for the heads up Jose Rocha!
I must've forgotten about the default password there so will edit my post to include that :)
Edit: Thanks a bunch! Added it now ;)
Pablo Rocha
10,142 PointsHarry James No problemo
3 Answers
Harry James
14,780 PointsMarking as resolved
aimensasi
11,343 PointsThanks for the help
kattor marion
42 Points1) Open Android Studio; 2) Open Your Project; 3) Click on Gradle (From Right Side Panel, you will see Gradle Bar); 4) Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project); 5) Click on Your Project (Your Project Name form List (root)); 6) Click on Tasks; 7) Click on android; 8) Double Click on signingReport (You will get SHA1 and MD5 in Run Bar)
Trainer Workout
22,341 PointsThis is the easiest way. Thanks alot.
Kien Doan
17,538 PointsThis is really helpful. My cmd in Windows 7 doesn't work whatsoever. Thanks a lot!
Darnell Cephus
4,208 PointsNice job! Thanks for all the help! This method still works in Oct. 2016
Jacob Bergdahl
29,119 PointsJacob Bergdahl
29,119 PointsHarry, you're a rockstar. Treehouse wouldn't function without you, let me tell you. Unfortunately, it didn't quite work for me. I located the jdk-file, and I've got the path to the keystore (it's the same for me as for you), however it's telling me that the keystore doesn't exist, even though I can clearly see it (debug.keystore). I tried going directly to debug.keystore by adding it in the path, and now it asks me for the password to the keystore, however it's locking me out from typing anything, and pressing enter will just tell me that the password is incorrect!