691

I am trying to make a Map app in Android Studio, on Windows. How can I find the 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 a similar option.

I read in the documentation that

Android Studio signs your app in debug mode automatically when you run or debug your project from the IDE.

So I tried setting my Java bin path and running the following command, taken from here:

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

However, I got an error message saying that it is an illegal option.

Step by step, how do I get this information in Android Studio?

As a workaround: I previously registered my app using the SHA-1 fingerprint generated by Eclipse. Can I use the same API key to work on my project in Android Studio?

3

48 Answers 48

1489

Easiest ways ever:

Update added for Android Studio V 2.2 in last step

There are two ways to do this.

1. Faster way:

  1. 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(Sometimes it will be in Gradle Console))
  9. Select app module from module selection dropdown to run or debug your application

Check the screenshot below:

enter image description here

2. Work with Google Maps Activity:

  1. Open Android Studio
  2. Open Your Project
  3. Click on File menu -> Select New -> Click on Google -> Select Google Maps Activity
  4. A dialog would appear -> Click on Finish
  5. Android Studio would automatically generate an XML file named with google_maps_api.xml
  6. You would get debug SHA1 key here (at line number 10 of the XML file)

Check Screenshot below:

Enter image description here

Android Studio V 2.2 Update

There is an issue with Execution.

Solution:

  • Click on Toggle tasks execution/text mode from Run bar

Check Screenshot below:

enter image description here

Done.

29
  • 8
    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? Jan 25, 2016 at 13:35
  • 2
    Nice to have way to find it that doesn't involve the command line. Jan 28, 2016 at 19:00
  • 2
    you are the shit dude this works perfectly since I couldnt locate debug.keystore in my .android folder @HirenPatel
    – Manny265
    Mar 7, 2016 at 9:34
  • 2
    For release SHA1 for keystore, please refer stackoverflow.com/questions/15727912/… one Mar 7, 2016 at 10:08
  • 12
    As of Android Studio 2.2 it shows up in Gradle console not Run
    – adsamcik
    Sep 21, 2016 at 7:02
343

My 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 android

Example:

keytool -list -v -keystore c:\users\James\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android

Or 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 android

And 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:

Enter image description here

5
  • 1
    keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android Instead of typing your own username
    – user3137329
    Aug 1, 2015 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, 2015 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 Jan 5, 2016 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, 2016 at 13:33
  • For macOS/Linux user the command is keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
    – M.Ed
    Jul 9, 2022 at 19:15
297

Many Users has given their answers and it's working fine in Android Studio's version below 4.2. But for Android Studio 4.2 and newer version ,follows these steps to generate SHA Key . Steps are given in these pictures.

Steps:-

1) Click on the gradle. Top right on the Android Studio. As you can see in this picture.

Step1

2) Now click on icon as seen in below picture. A new searchable windows/screen will open.

SHA2

3) Now type,gradle signingreport and press Enter to start generating SHA KEY as seen in below picture.

sha3

4) Your SHA Key will generate as seen in this picture. Using these steps you can generate SHA KEY in Android Studio 4.2.

sha4

Note:- If you are not able to get SHA key then follow instructions given in this answer.(FLUTTER/React Native ...)

Link:-SHA Key for flutter/react native

21
  • 25
    Thanks! This should be at the top of the list as the updated solution/answer
    – Chichebe
    Jun 18, 2021 at 16:40
  • 1
    Thanks, This seems like latest answer than accepted answer. Jul 22, 2021 at 11:10
  • 2
    THANK YOU VERY MUCH! Dec 2, 2021 at 15:33
  • 4
    best for 2022 android Dec 7, 2021 at 13:27
  • 2
    The best! Thank you, worked on mine!
    – Erika
    Jan 26, 2022 at 7:23
182

For Mac, this worked perfectly:

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
2
  • fine for me also Oct 9, 2017 at 11:04
  • for me it was this command on Mac: keytool -list -v -keystore /Users/danalboteanu/AndroidStudioProjects/my_android/googleplay.jks -alias myAlias -storepass myStorePass -keypass myKeyPass Sep 16, 2021 at 15:21
116

I just found the case to get SHA-1 in Android Studio:

  1. Click on your package and choose New -> Google -> Google Maps Activity
  2. Android Studio redirects you to google_maps_api.xml

And you will see all you need to get google_maps_key.

Image

1
  • 2
    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. Jun 24, 2015 at 15:27
60

In Android studio 4+ (not sure about version), if you click on Gradle on the right bar, it won't show you any option to generate signing report. It will show you this:enter image description here

Click on Task list not built... info and un-check the option Do not build gradle task list.. and save the settings.

enter image description here

Then click gradle sync button: enter image description here

Then you'll see the signingreport option: enter image description here

2
57

The 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:

5
  • Thank you for this! None of the other alternatives worked, and this was actually even more simple anyway.
    – Kebman
    Mar 19, 2017 at 16:04
  • Thankyou so much buddy ! May 2, 2017 at 5:31
  • On Android 3.1.4: Tasks -> android -> signingReport
    – Mete
    Aug 29, 2018 at 7:36
  • the best answer Nov 12, 2019 at 14:29
  • 3
    but this doesn't generate SHA1 for release, only for debug Nov 19, 2020 at 17:53
48

[Updated 2017]

Step 1: On Top Right side of Android Studio Click On Gradle option.

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)

enter image description here

Step 3: Click on the Gradle Console option present bottom of Android Studio to see your SHA1 Key.

enter image description here

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.

enter image description here

Like this.

enter image description here

Step 5: Happy Coding!!

1
  • Thank you for including the oh-so-important step 4!
    – SMBiggs
    Dec 3, 2020 at 16:25
44

for me the shortest way is to type ./gradlew signingReport in the terminal command line.

P.s : if you are in Windows use .\gradlew signingReport instead.

4
  • You can even use the Terminal tab inside Android Studio which saves you from having to navigate to the correct folder for your project.
    – wildcat12
    Feb 18, 2021 at 23:21
  • exactly, that's what i meant by ' terminal command line'.
    – narcis dpr
    Feb 20, 2021 at 4:14
  • 3
    For Android Studio v. 4 +, the Gradle tab thing doesn't show anything. This is what works. Jun 7, 2021 at 9:51
  • 2
    @whoadityanawandar You can re-enable the gradle tasks from the settings menu. Settings -> experimental -> uncheck "Do not build Gradle task list during Gradle sync". Then resync your Gradle and the tasks should appear. Jul 7, 2021 at 12:48
42

If you just want the SHA certificate values, run the following command from the android folder:

 gradlew signingReport

...that'll give you a quick and easy view of your fingerprint

3
  • 1
    By far, the simplest method that works immediately. Just open the Terminal in Android Studio, and run the above command. It displays the SHA-1 fingerprint certificate after about 5 seconds.
    – Mr L
    Jun 14, 2021 at 8:02
  • Precise and easy
    – Brian
    Sep 1, 2021 at 13:38
  • For Linux system: ./gradlew signingReport Aug 30, 2022 at 10:17
33

I did this way:

Step 1: Go to this folder

On Mac: /Users/<username>/.android/

On Windows: C:\Documents and Settings\<username>\.android\

On Linux: ~/.android/

Step 2: Run this command line:

keytool -list -v -keystore debug.keystore -storepass android

You will see the SHA-1 key.

2
  • /Users/<username> for Mac is user's home folder, so ~ shortcut can be used, just like for Linux Sep 25, 2019 at 15:13
  • For Windows it should be "C:\Users\<username>\.android\ " Jun 7, 2021 at 9:45
28

For Linux & Mac

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android 
4
  • @vicky Example please.. /home/desktop/././. , abc.jks, which password n all, do we need all these details??
    – Prabs
    Nov 27, 2015 at 11:45
  • @prabs, I cannot get you. can you explain bit more?
    – Vicky
    Dec 21, 2015 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, 2015 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, 2016 at 6:37
24

i am going with @Hiren Patel answer but slightly change in android studio 2.2 and later

enter image description here

2
  • i am unable to find this toggle in android studio 2.2.2 Nov 12, 2016 at 4:56
  • Have you follow @hiren Patel's answer step by step?? Nov 12, 2016 at 7:52
19
  1. Click on Gradle Icon in Right Pane.
  2. Click on Root Project Name.
  3. Click Tasks
  4. Click Android
  5. Click signingReport
  6. in bottom pane where you see Run report
  7. Click "Toggle Tasks Execytions/text mode"
  8. you can see the sha-1

Android Studio SHA-1

1
  • 1
    Thanks. worked great. /i didnt know i had to toggle it.
    – Raul
    Feb 28, 2018 at 6:43
18

in the terminal type this command

gradle signingReport

very important

press Ctrl + enter

⚠ not enter

2
  • " The term 'gradle' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
    – Jorgesys
    Sep 28, 2022 at 15:49
  • 2
    please make sure you are pressed ctrl + enter not only enter Jorgesys Nov 13, 2022 at 7:01
16

I 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
1
  • 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, 2017 at 18:15
15

Above answers give me a command not found error The correct terminal command that works for me was

./gradlew signingReport
1
  • You can press CTRL+Enter after this command, as recommended by Android Studio. Jan 31, 2022 at 11:32
12

For Android Studio 4.2 or new

Goto the Gradle on the right side

enter image description here

Open it and then Click on Execute Gradle Task and this pan is open enter image description here

then you have to type signingreport and press enter this will execute the command and will provide the result.

For Older Version of Android Studio

You can follow all of the above steps on the older version to get your result.

12

Recently Android Studio and in its last update 2020.3.1 has removed signingReport from Gradle sidebar but you can still get these details in Android studio in Terminal, just write the following command:

Windows:

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

Linux & MacOS:

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android 
12

Follow the simple following steps to get SHA-1, SHA-256 & MD5:

  1. Click on Gradle placed at top right side of IDE. Gradle option at top right side of android studio IDE.
  2. Click on Gradle icon. Image showing Gradle icon.
  3. A popup window will opened, write signingReport after Gradle word & press enter. Write signingReport inside popup.
  4. Signing report will be generate. Signing report.
3
  • 2
    As a Mac user, only this solution worked. Saved my day. Thanks! Jun 12, 2022 at 20:01
  • Unable to find anything under the app which opens from the right side.
    – Arbaz.in
    Jan 25 at 5:45
  • @Arbaz.in if gradle is not showing on right side then please "ctrl + shift + A" in windows or "cmd + shift + A" in mac. A top bar will appears then switch to "Action" & write "gradle". Click on it and do above process. Jan 26 at 6:08
11

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.keystore

I 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.)

3
  • 1
    I did what you said above but I don't get the release SHA1, for release it returns me: Variant: release Config: none Jan 25, 2016 at 14:41
  • Menu AndroidStudio: build/generated signed apk and create new file. After change signingConfig>release on build.gradle (above) Jan 29, 2016 at 18:27
  • I Ran this command using gradel script though that was not available in the list, it worked and I received the android debug key.
    – Malay M
    May 27, 2021 at 0:35
10

I found a very easy process to find you MD5, SHA-1 fingerprint using Android Studio.

  1. Run your project
  2. Go to Gradle Menu (Menu: View -> Tool Windows -> Gradle)
  3. Go to 'signingReport' in Gradle window. (Your project -> Tasks -> android -> signingReport)
  4. Run it. (Using double-click or Ctrl + Shift + F10)
  5. In Run window you will find all info.

It's work only for debug mode. In realease mode I can not see sha-1. Here result of gradlew signingReport

Variant: release
Config: none
----------
Variant: releaseUnitTest
Config: none
----------
Variant: debug
Config: debug
Store: path\Android\avd\.android\debug.keystore
Alias: AndroidDebugKey
MD5: xx:xx:xx:62:86:B7:9C:BC:FB:AD:C8:C6:64:69:xx:xx
SHA1: xx:xx:xx:xx:0F:B0:82:86:1D:14:0D:AF:67:99:58:1A:01:xx:xx:xx
Valid until: Friday, July 19, 2047
----------

So I must use keytool to get sha-1. Here official Firebase doc:

Get_sha-1_for_release

9

It'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 android 

Second: Now copy and paste the command in the terminal the Android Studio enter image description here

Result!

enter image description here

Good Luck!!

9

For getting SHA1 for a production keystore:

  1. Build --> Generate Signed APK...

  2. Create keystore with password and follow the steps

  3. 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.

  4. 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 -v
    

    Erase 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.

  5. Press Enter and enter the password :)

  6. 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.

1
  • 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, 2016 at 18:51
8

goto this website and find for yourself https://developers.google.com/android/guides/client-auth

method1 : ./gradlew signingReport

method2 :

    (a) for mac/linux

 keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore




     (b) for windows ==>
keytool -list -v \
-alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore

password : android

1
  • if you want to connect android studio with firebase , using sha;;1 , just goto tools->firebase-> and follow the given steps , they automatically add sha1 to firebase, automatically download and save google-json file, and you can also add dependecies from there
    – UNREAL
    May 15, 2022 at 18:26
7

Click on the Terminal icon on the bottom left corner Terminal

cd to the android folder and run

gradlew signingreport

Once this is done, it will print the SHA-1, MD5, and SHA-256 keys

6

If 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:

Enter image description here

3
  • But this will only work for debugging. You have to manually determine the release key fingerprint.
    – Hyndrix
    May 11, 2015 at 4:51
  • @Hyndrix how do you manually determine the release key fingerprint?
    – Micro
    Aug 17, 2015 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, 2017 at 16:09
6

This 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
0
5

Click 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.

5

For Windows 10, from the Android Studio terminal:

keytool -exportcert -alias androiddebugkey -keystore %USER_PROFILE%"/.android/debug.keystore -list -v

Note: For the debug.keystore, the password is "android". The debug keystore is typically located at "%USER_PROFILE%"/.android/debug.keystore.

Not the answer you're looking for? Browse other questions tagged or ask your own question.