I have shifted myself from Eclipse to Android Studio. Now I am trying to work on my Map app. So I need my SHA-1 fingerprint certificate number.
When I was using Eclipse it was right under Windows -> Preferences -> Android -> Build. But in Android Studio I couldn't find out any option like this so that I could find easily the fingerprint. I am using Windows. I have read from this link that:
Android Studio signs your app in debug mode automatically when you run or debug your project from the IDE.
So I tried to run this in command line after setting my Java bin path from this link and unfortunately couldn't find my fingerprint. It is saying that it is an illegal option.
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass androidIs there a way to find the SHA-1 fingerprint from Android Studio like it was very easy in Eclipse? As I am newbie in Android Studio, what is the full process to find it?
Another thing I want to add is that I have my Eclipse generates the SHA-1 fingerprint and previously I have my app registered on that fingerprint in Google developer console, and I worked on that app in Eclipse by that API key. Is the same API key can be worked on this my project in Android Studio?
android google-maps android-studio share improve this question edited Sep 30 '16 at 19:28 Peter Mortensen 11.2k 16 78 110 asked Dec 22 '14 at 19:47 setu basak 2,907 5 17 35 1 Easiest way to Get SHA-1 For Release and Debug mode android studio gradle. Check this – Naeem Ibrahim Nov 16 '16 at 6:21 add a commentEasiest ways ever:
There are two ways to do this.
1. Faster way:
Open Android Studio Open your Project Click on Gradle (From Right Side Panel, you will see Gradle Bar) Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project) Click on Your Project (Your Project Name form List (root)) Click on Tasks Click on Android Double Click on signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console)) Select app module from module selection dropdown to run or debug your applicationCheck the screenshot below:
2. Work with Google Maps Activity:
Open Android Studio Open Your Project Click on File menu -> Select New -> Click on Google -> Select Google Maps Activity A dialog would appear -> Click on Finish Android Studio would automatically generate an XML file named with google_maps_api.xml You would get debug SHA1 key here (at line number 10 of the XML file)Check Screenshot below:
There is an issue with Execution.
Solution:
Click on Toggle tasks execution/text mode from Run barCheck Screenshot below:
Done.
share improve this answer edited Jul 4 at 15:14 micstr 2,108 2 21 50 answered Dec 11 '15 at 12:22 Hiren Patel 26.3k 12 96 105 4 Great :) but can I use the this SHA1 (Produced as you described) in my Google Developer Console to create a Credentials for my application? Because it in (Signing Report) window it says (config: debug) not release mode? – Ashraf Alshahawy Jan 25 '16 at 13:35 2 Nice to have way to find it that doesn't involve the command line. – Androidcoder Jan 28 '16 at 19:00 2 What about release... – Vlado Pandžić Feb 8 '16 at 20:50 2 you are the shit dude this works perfectly since I couldnt locate debug.keystore in my .android folder @HirenPatel – Manny265 Mar 7 '16 at 9:34 10 As of Android Studio 2.2 it shows up in Gradle console not Run – adsamcik Sep 21 '16 at 7:02 show 23 more comments up vote 257 down voteMy problem is the same as I have also shifted my Google Maps project from Eclipse to Android Studio. I have solved my problem by following this:
Go to your Java bin directory via the command:
C:\Program Files\Java\jdk1.7.0_71\bin>Now type in the below command in your command window (CMD.EXE):
keytool -list -v -keystore c:\users\your_user_name\.android\debug.keystore -alias androiddebugkey -storepass android -keypass androidExample:
keytool -list -v -keystore c:\users\James\.android\debug.keystore -alias androiddebugkey -storepass android -keypass androidOr you can just write this in cmd if you don't know the username:
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass androidAnd you will get the SHA1.
Then I created a new key from https://code.google.com/apis/console because of my package name got changed and then use this key in my application. It works fine.
Make sure you are in BIN folder of jdkX.X.X_XX (my folder name is jdk1.7.0_71), or else if you don't know what folder name you have then find it by opening the Java folder, and you will see what the folder name is, but you must be in your BIN folder and then run this command. Today I have got my SHA1 value in a cmd command window by the above procedure.
SNAPSHOT:
share improve this answer edited Sep 16 '16 at 4:29 Peter Mortensen 11.2k 16 78 110 answered Dec 24 '14 at 15:23 Jamil 3,866 2 14 24 1 keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android Instead of typing your own username – mrpink Aug 1 '15 at 5:05 Yes but as "keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android " is already showed in many of the examples in stack overflow...i just want to give another example. – Jamil Aug 1 '15 at 21:34 1 I couldn't copy the SHA1 from the CMD so I moved the whole output of your given command to a file by adding: > output.txt behind your command. You can also add | clip behind the command. You will get the output of the command in your Windows Clipboard. I hope it also saves time for others. More info about using | clip – SPottuit Jan 5 '16 at 14:58 1 @SPottuit: Interesting tip for clip.exe, din't know it existed, thanks. Also, removing -v will give you the SHA1 only as output, or on Windows you can pipe the output from -v through | find "SHA1" | clip – Dan Dar3 Mar 22 '16 at 13:33 1 This should be marked as solution. – parohy Dec 12 '16 at 13:03 add a comment up vote 105 down vote
I just found the case to get SHA-1 in Android Studio:
Click on your package and choose New -> Google -> Google Maps Activity Android Studio redirects you to google_maps_api.xmlAnd you will see all you need to get google_maps_key.
share improve this answer edited Sep 30 '16 at 19:33 Peter Mortensen 11.2k 16 78 110 answered Feb 22 '15 at 10:28 Stanislav Bondar 2,051 2 12 24 1 I found the Sha1 but it screw me up the project, it said "Error:exception during working with external system:" and change all structure on my project.... Thanks!!! for nothing!!! i think there is no way to get back. – user3050757 Jun 24 '15 at 15:27 If you get warnings, just read it before confirm – Stanislav Bondar Jun 25 '15 at 19:05 add a comment up vote 88 down vote
For Mac, this worked perfectly:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android(A Google search landed me here.)
share improve this answer edited Mar 9 '15 at 20:04 jap1968 6,213 1 20 29 answered Feb 5 '15 at 17:33 JoeNCA 889 3 4 Works fine, thanks. – overallduka May 20 '16 at 14:04 for fedora also only this one is working perfectly – Amit Upadhyay Aug 28 '16 at 16:58 add a comment up vote 27 down voteThe best solution for generating an SHA-1 key for Android is from Android Studio.
Click on Gradle on the far right side:
Click on the refresh icon, and you will see the name of the app:
Click on Tasks -> Report -> Signing Report:
Find the SHA-1 key on the bottom part in the console:
share improve this answer edited Sep 30 '16 at 19:20 Peter Mortensen 11.2k 16 78 110 answered Mar 28 '16 at 7:18 Ismaran Duwadi 925 8 10 this is the best alternative for me. thanks – Jimmy Ilenloa Aug 28 '16 at 3:51 1 not work in android studio 2.2 – Arpit Patel Oct 3 '16 at 8:14 Thank you for this! None of the other alternatives worked, and this was actually even more simple anyway. – Kebman Mar 19 at 16:04 Thankyou so much buddy ! – Hanish Sharma May 2 at 5:31 add a comment up vote 19 down vote
i am going with @Hiren Patel answer but slightly change in android studio 2.2
share improve this answer answered Oct 4 '16 at 6:26 Arpit Patel 3,599 2 23 38 i am unable to find this toggle in android studio 2.2.2 – Zeeshan Shabbir Nov 12 '16 at 4:56 Have you follow @hiren Patel's answer step by step?? – Arpit Patel Nov 12 '16 at 7:52 I got it already thanks. Your answer helped me – Zeeshan Shabbir Nov 12 '16 at 7:59 your welcome..... – Arpit Patel Nov 12 '16 at 8:09 add a comment up vote 19 down vote
[Updated 2017]
Step 1: On Top Right side of Android Studio Click On Gradle option.
Step 2:
-- Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)
-- Click on Your Project (Your Project Name form List (root))
-- Click on Tasks
-- Click on Android
-- Double Click on signingReport (You will get SHA1 and MD5 in Gradle Console/Run Bar)
Step 3: Click on the Gradle Console option present bottom of Android Studio to see your SHA1 Key.
Step 4: Now you got the SHA key but you can't run your project.That is why Change your configuration to app mode. See image below.
Like this.
Step 5: Happy Coding!!
share improve this answer edited Jan 12 at 19:12 answered Dec 20 '16 at 7:48 Dinesh Sunny 2,216 1 15 19 add a comment up vote 10 down voteFor Linux
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android share improve this answer answered Sep 11 '15 at 12:56 vicky 2,617 17 22 @vicky Example please.. /home/desktop/././. , abc.jks, which password n all, do we need all these details??– Prabs Nov 27 '15 at 11:45 @prabs, I cannot get you. can you explain bit more? – vicky Dec 21 '15 at 5:16 @vicky do we need to edit the command before executing it.. If yes, then what details we should give. That's my query. – Prabs Dec 21 '15 at 5:23 1 @prabs, you no need to give any extra info for debug key, You just execute the above command in your linux terminal. – vicky Jan 18 '16 at 6:37 add a comment up vote 10 down voteI directly used the following command from my Mac using the terminal. I got SHA1 Finger. This is the command:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android share improve this answer edited Sep 30 '16 at 19:01 Peter Mortensen 11.2k 16 78 110 answered Jun 11 '15 at 6:00 Hanuman 484 5 30 working good for mac – Ramesh Sambu Feb 14 at 6:57 it will work for windows also cmd is : keytool -list -v -keystore %USERPROFILE%\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android – Hanuman May 11 at 18:15 add a comment up vote 7 down voteIt's very very easy in Gnu/Linux - Mac - Windows
First: - copy this command
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass androidSecond: Now copy and paste the command in the terminal the Android Studio
Result!
Good Luck!!
share improve this answer answered Mar 18 '16 at 17:19 David Hackro 1,747 1 23 34 add a comment up vote 7 down voteFor getting SHA1 for a production keystore:
Build --> Generate Signed APK...
Create keystore with password and follow the steps
Go to your Mac/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin and drag the bin folder to the terminal after cd command to point at it so you can use the keytool tool. So, in terminal write cd (drag bin here) then press enter.
Then, copy and paste this in the terminal:
keytool -exportcert -alias Your_keystore_AliasName -keystore /Users/Home/Development/AndroidStudioProjects/YoutubeApp/app/YoutubeApp_keystore.jks -list -vErase my path and go where you stored your keystore and drag your keystone and drop it after -keystore in the command line so the path will get created.
Also, erase Your_keystore_AliaseName to put your alias keystone name that you used when you created it.
Press Enter and enter the password :)
When you enter the password, the terminal won't show that it receives keyboard entries, but it actually does, so put the password and press Enter even if you don't see the password is typed out.
share improve this answer edited Sep 30 '16 at 19:11 Peter Mortensen 11.2k 16 78 110 answered Sep 16 '15 at 23:20 fullMoon 1,452 1 18 24 you got my THANK SO MUCH award for When you enter the password, the terminal won't show that it receives keyboard entries, but it actually does. – FARID Oct 23 '16 at 18:51 add a comment up vote 6 down voteIf you have Android Studio then it is very very simple. Just create a MapActivity using Android Studio and after creating it go into google_maps_api.xml. In there there will be a link given in comments. If you paste it in your browser, it will ask a few details to be filled in and after that your API will be generated. There is no need of using keytool and all.
Screen shot:
share improve this answer edited Sep 30 '16 at 19:01 Peter Mortensen 11.2k 16 78 110 answered Mar 21 '15 at 13:03 Rizwan Ahmed 199 2 11 But this will only work for debugging. You have to manually determine the release key fingerprint. – Hyndrix May 11 '15 at 4:51 @Hyndrix how do you manually determine the release key fingerprint? – MicroR Aug 17 '15 at 18:33 This is a totally unecessary step. No need to create a MapActivity just for this. You just need to look in your Gradle Projects > app > Tasks > android > signingReports, and see the result in the Gradle Console under SHA1. – Kebman Mar 19 at 16:09 add a comment up vote 6 down vote
If you are using Android Studio, you can get the SHA-1 and MD5 certificate fingerprint (debug, release... all Build Types!!) fast through Gradle Tasks:
signingReport
The SHA-1 and MD5 certificates are shown in Messages Logs.
Android Plugin (configured in the Gradle app) creates a debug mode for default.
com.android.application
File route to keystore:
HOME/.android/debug.keystoreI recommend to attach debug.keystore to build.gradle. To do this put a file, debug.keystore, in an app folder and then Add SigningConfigs in Gradle app:
apply plugin: 'com.android.application' android { ................ signingConfigs { debug { storeFile file("../app/debug.keystore") storePassword "android" keyAlias "androiddebugkey" keyPassword "android" } release { storeFile file("../app/debug.keystore") storePassword "android" keyAlias "androiddebugkey" keyPassword "android" } } ........ }Extra: If you want creates for release, put a file, release.keystore, in an app folder. (This example uses the same debug.keystore.)
share improve this answer edited Sep 30 '16 at 19:34 Peter Mortensen 11.2k 16 78 110 answered Jun 27 '15 at 20:49 SergioLucas 1,024 6 15 1 I did what you said above but I don't get the release SHA1, for release it returns me: Variant: release Config: none – Ashraf Alshahawy Jan 25 '16 at 14:41 Menu AndroidStudio: build/generated signed apk and create new file. After change signingConfig>release on build.gradle (above) – SergioLucas Jan 29 '16 at 18:27 add a comment up vote 4 down voteFor Windows 10, from the Android Studio terminal:
keytool -exportcert -alias androiddebugkey -keystore %USER_PROFILE%"/.android/debug.keystore -list -vNote: For the debug.keystore, the password is "android". The debug keystore is typically located at "%USER_PROFILE%"/.android/debug.keystore.
share improve this answer edited Sep 30 '16 at 19:14 Peter Mortensen 11.2k 16 78 110 answered Oct 16 '15 at 5:47 Javad Jafari 662 4 10 add a comment up vote 4 down voteI want to add one thing with the answer given by Softcoder. I have seen some people couldn't give their debug.keystore path correctly on the command line. They see that they are doing the exact process accepted above, but it is not working. At that point try to drag the debug.keystore and drop it on the command line. It will help if the accepted answer is not working for you. Do the full process without any hesitation. It was a nice answer.
share improve this answer edited May 23 at 12:10 Community ♦ 1 1 answered Jan 22 '15 at 7:35 setu basak 2,907 5 17 35 add a comment up vote 3 down voteI found a very easy process to find you MD5, SHA-1 fingerprint using Android Studio.
Run your project Go to Gradle Menu (Menu: View -> Tool Windows -> Gradle) Go to 'signingReport' in Gradle window. (Your project -> Tasks -> android -> signingReport) Run it. (Using double-click or Ctrl + Shift + F10) In Run window you will find all info. share improve this answer edited Dec 8 '15 at 9:01 answered Dec 8 '15 at 8:16 Md Sufi Khan 1,022 9 14 add a comment up vote 3 down voteUse simple command:
keytool -exportcert -keystore path-to-debug-or-production-keystore -list -v
and you will get the SHA1 key.
share improve this answer answered Nov 10 '16 at 14:18 Sangeeta 493 1 5 24 add a comment up vote 2 down voteClick the Gradle icon on the right panel, then click on the (root).
Tasks > android > signingReport
Then the Gradle script will execute, and you will see your keys.
share improve this answer edited Jan 12 '16 at 7:54 Drenmi 5,199 4 21 39 answered Jan 12 '16 at 7:15 Balman Rawat 2,120 1 7 8 add a comment up vote 2 down voteUse the instructions from the API Manager using keytool:
Get the package name from your AndroidManifest.xml file. Then use the following command to get the fingerprint:
keytool -list -v -keystore mystore.keystore
share improve this answer answered Apr 16 '16 at 23:22 Jorgesys 69.7k 12 199 173 add a comment up vote 2 down voteThis worked in my case: Use %USERPROFILE% instead of giving path .keystore file stored in this path automatically C:Users/user name/.android:
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android share improve this answer edited Sep 30 '16 at 19:18 Peter Mortensen 11.2k 16 78 110 answered Mar 1 '16 at 5:29 KCN 175 17 add a comment up vote 2 down voteI do it this way:
Step 1: Go to this folder
On Mac: /Users//.android/
On Windows: C:\Documents and Settings\.android\
On Linux: ~/.android/
Step 2: Run this command line:
keytool -list -v -keystore debug.keystore -storepass androidYou will see the SHA-1 key.
share improve this answer edited Sep 30 '16 at 19:23 Peter Mortensen 11.2k 16 78 110 answered May 20 '16 at 3:30 Son Nguyen Thanh 558 6 15 add a comment up vote 1 down voteThis worked for me:
keytool -exportcert -alias androiddebugkey -keystorePut path-to-debug-or-production-keystore here like C:\users\youruser.android\debug.keystore -list -v
Make sure you already are in the Java\jdk*\bin directory in a command or terminal window.
Then use Android as the password.
Sometimes web resources could be misleading. These are the ones working:
SHA1 Fingerprint Tutorial
Quick Start Sample app
share improve this answer edited Sep 30 '16 at 18:59 Peter Mortensen 11.2k 16 78 110 answered Mar 1 '15 at 0:16 Jenia 19 1 add a comment up vote 1 down voteIf you need SHA1 for Google Maps, you can just see your error log in LogCat.
share improve this answer edited Sep 30 '16 at 19:15 Peter Mortensen 11.2k 16 78 110 answered Dec 7 '15 at 8:06 Anton Smirnov 59 2 add a comment up vote 1 down voteWhen creating a new "Google Maps Project", in Android Studio V 1.5.1, the last screen opens the google_maps_api.xml file and displays the screen with instructions as follows:
Resources:
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r= YOUR SHA-1 + YOUR PACKAGE NAME
You can also add your credentials to an existing key, using this line: YOUR SHA-1:YOUR PACKAGE NAME
Alternatively, follow the directions here: https://developers.google.com/maps/documentation/android/start#get-key
Once you have your key (it starts with "AIza"), replace the "google_maps_key" string in this file. <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR GOOGLE MAPS KEY</string>
To get YOUR GOOGLE MAPS KEY just cut and paste the URL link given into your browser and follow the instructions above at the time of creating the new application. The SHA-1 and Package names are already in the link given so you do not need to know them. They will however be in your project in the resources>Values>google_maps_api.xml file which is completed when you follow the instructions on creating the project.
share improve this answer edited Sep 30 '16 at 19:18 Peter Mortensen 11.2k 16 78 110 answered Feb 17 '16 at 15:03 Anthony 21 1 add a comment up vote 0 down voteGo to File > Project Structure Select 'app' or 'mobile' whatever you gave the name from 'Modules' Choose 'Signing' tab.
You can add certificate clicking on the '+' button.
share improve this answer answered Dec 23 '14 at 8:21 skabir 629 8 23 Could you please show me detail step by giving any example?? – setu basak Dec 23 '14 at 8:33 add a comment up vote 0 down voteThe easiest way to get the finger print is to switch from app to signed report by clicking the drop down and click build.
Then you will be able to see the sha1 fingerprint at the bottom pane where you see the debug report and stack trace. N.B remember to switch back to app when you want to run your app on a device or an emulator.
share improve this answer answered May 30 '16 at 22:07 The_Martian 725 8 27 add a comment up vote 0 down voteYou can use following command and change AJAY SUNDRIYAL with your system name.This is only for your debug.keystore.This will work for you.
C:\Program Files\Java\jdk1.8.0_91\bin>keytool -list -v -keystore "c:\users\AJAY SUNDRIYAL\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android share improve this answer answered Aug 24 '16 at 13:19 SANJAY GUPTA 627 4 15 add a comment up vote 0 down voteThe path of the keystore is in double quotes. It is working fine.
keytool -list -v -keystore "C:\Users\App innovation\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android share improve this answer edited Sep 30 '16 at 19:07 Peter Mortensen 11.2k 16 78 110 answered Aug 6 '15 at 8:08 Happy Singh 161 2 3 add a commentThank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count). Would you like to answer one of these unanswered questions instead?