637

Is the method for getting an SHA-1 fingerprint the same as the method of getting the fingerprint? Previously, I was running this command:

Windows Command Prompt running keytool.exe

It's not clear to me if the result I'm getting is the SHA-1 fingerprint. Can somebody clarify this?

5

47 Answers 47

1213

Follow this tutorial for creating SHA1 fingerprint for Google Map v2

For Debug mode:

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

for Release mode:

keytool -list -v -keystore {keystore_name} -alias {alias_name}

example:

keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test

On windows, when keytool command is not found, Go to your installed JDK Directory e.g. <YourJDKPath>\Java\jdk1.8.0_231\bin\, open command line and try the above commands for debug/release mode.

Another way of getting your SHA1 OR SHA-256 use ./gradlew signingReport

For more detailed info visit Using Gradle's Signing Report

12
  • 11
    ~/ is your home directory in *nix systems. Under Windows, just use %USERPROFILE%
    – Jay Sidri
    Nov 25, 2014 at 23:28
  • 3
    If you're writing Android apps on Xamarin, use this: keytool -list -v -keystore "%USERPROFILE%\AppData\Local\Xamarin\Mono for Android/debug.keystore" -alias androiddebugkey -storepass android -keypass android
    – Jay Sidri
    Nov 25, 2014 at 23:32
  • how to get release sha1. I am getting it from my app.jks but console.google is showing its already used. Jul 6, 2016 at 10:26
  • 1
    $ keytool -list -v -keystore ~/.android/debug.keystore -storepass android only this also works
    – Napolean
    Mar 16, 2017 at 7:40
  • 1
    Look at this to get SHA-1 key using android studio. easybook4u.com/index.php/2017/08/25/… Aug 28, 2017 at 15:31
743

If you are using android studio use simple step

  1. Run your project
  2. Click on Gradle menu
  3. Expand Gradle Tasks tree
  4. Double click on android -> signingReport and see the magic
  5. It will tell you everything on the Run tab

enter image description here

Result Under Run Tab If Android Studio < 2.2
enter image description here

From android studio 2.2
Result will be available under Run console but use highlighted toggle button

enter image description here

Or
Second Way is
Create new project in android studio New -> Google Maps Activity

enter image description here

then open google_maps_api.xml xml file as shown in pics you will see your SHA key

enter image description here

16
  • 4
    My 'gradle projects' window is empty... any ideas why that might be?
    – LairdPleng
    Nov 5, 2015 at 11:02
  • 1
    It will appear once you run the project either in emulator or on device Nov 5, 2015 at 17:53
  • 1
    Yea I tried that but nothing happened. Seems as though, in my case, I had to press the 'refresh' button before anything showed up!
    – LairdPleng
    Nov 6, 2015 at 6:48
  • 3
    It now appears under "Gradle Console" tab from Android studio 2.2.3
    – Irfan Raza
    Dec 18, 2016 at 1:58
  • 2
    I've followed the steps in this answer and it works great. But how to change the Gradle setting back to whatever it was so that when I click the Run button in Android Studio, it installs and runs the app on my device/emulator as it did previously? Jan 16, 2018 at 11:53
210

Easiest way for getting SHA1 Key in android studio both (Debug and release Mode)

  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)
  6. Click on Tasks/Android
  7. Double Click on signingReport (You will get SHA1 and MD5 in Run Bar)

If you are using new Android Studio it shows time to execute on top there is Toggle task execution mode click on that you will get you SHA-1 key. Check 2nd and 3rd reference images.

Check image for details enter image description hereenter image description here

Generate SHA-1 for Release Mode

1-First add keystore config in your gradle How to add config in gradle.

2-After Adding Config in gradle change build variant. enter image description here

3-Then Follow Above Procedure you will get SHA-1 for release mode.

4-Check Image. enter image description here

2
  • 1
    How to change the location? I know how to change to a different keystore when signing, but what about the default one? Nov 14, 2016 at 23:09
  • 1
    very detailed answer with images, helps a lot... very easy to understand than other answers here... up-vote for the images in answer Dec 26, 2016 at 9:57
89

Go to your java bin directory via the cmd:

C:\Program Files\Java\jdk1.7.0_25\bin>

Now type in the below comand in your cmd:

keytool -list -v -keystore "c:\users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android 
1
  • thanks I used password as "android" that solved this issue
    – Braj
    Feb 26, 2022 at 5:12
45

If you are using eclipse, go to: Window->Preferences->Android->Build You will find what you are looking there.

enter image description here

1
  • 2
    Where can I find the equivalent on Android Studio? My IDE is pointing to the wrong SHA1 Nov 14, 2016 at 23:08
45

![Go to far left[![][1][1]

Please refer to the following images and get the SHA-1 key Refresh

View in console panel at bottom

2
  • Agree: best option. "Plused" one. I missed a l little bit more text information, but the main path you've shown. Thank you. Apr 2, 2017 at 3:44
  • 1)You have to double click on the filename. Jun 9, 2017 at 11:39
42

An easy answer. To find SH1 in the new Android Studio Version. Do these simple steps.

Step 1 Go to setting and you can also press CTRL + ALT + S

Edit

Step 2 for latest android studio including - Android Studio Electric Eel | 2022.1.1

Go to Experimental and then UnTick the option named Only include test tasks in the Gradle task list generated during Gradle Sync if it is Ticked and then press ok

Step 2 for older versions of the android studio -

Go to Experimental and then UnTick the option named Do not build Gradle task during Gradle sync if it is Ticked and then press ok

Continue

Step 3 Go to File then choose the option of Sync Project with Gradle files

Step 4 Click on Gradle on the right side of panel then Tasks then android then double click on signingReport

Then you will get the SH1 fingerprint

enter image description here

2
  • 2
    Thanks, This is best answer for latest android studio.
    – TexD
    Feb 1 at 21:22
  • this one, yes - is a comment worth the highest possible grade. In addition to being correct, he explains everything in detail. Aug 4 at 15:48
39

Run the following command to get your sha1: keytool -v -list -keystore "< debug.keystore path >"
If you do not know the path of debug.keystore, you may find your debug.keystore path by checking windows-->preferences-->android-->build

I prepared step by step tutorial to show how you can use google map android v2 on emulator(android 4.2.2)
have a look at to my blog: http://umut.tekguc.info/en/content/google-android-map-v2-step-step

38

I saw lots of posts about this issue, so I will keep it simple + examples.

To get the SHA1 for ClientID for Sign In with Google+ and more actions:

General Form:

keytool -list -v -keystore <your_keystore_full_path> -alias <your_alias_name>

For Debug, replace with your debug.keystore path, for Example :

keytool -list -v -keystore C:\Users\DAVID\.android\debug.keystore -alias androiddebugkey

Password: android

For Release, replace with your keystore path and alias password, for Example :

keytool -list -v -keystore C:\ProjectsData\keystore\my-release-key.keystore -alias alias_name 

Password: Your alias password.

3
  • 1
    Works great! I have included both a DEBUG and a RELEASE key in console.developer.google.com. Not sure if both are really needed. Nevertheless it works great, after spending 4 hours on this G**gle feature.
    – Vincent
    Oct 7, 2015 at 8:46
  • If your alias key have space like "App Moon" then add double quation "App Moon" as alias name. Jul 15, 2017 at 10:34
  • the best and working solution , for google clientID i needed SHA-1 in release mode , other solutions give us the SHA-1 in debug mode
    – ParSa
    Aug 1, 2019 at 12:02
34

This is step by step process of what worked for me.

First run the app then follow steps below (also shown in screenshot)

  1. click signing report
  2. open gradle console dialog
  3. it should display your SHA-1 certificate number

enter image description here

4
  • 1
    A true savior! I don't know why the SHA-1 key was different when generated from command prompt and android studio. Feb 21, 2019 at 16:11
  • 2
    it shows sha1 for debug, is this same for release variant also ? Dec 19, 2019 at 4:06
  • @SanketPatel are u got the release SHA1?
    – Oliver D
    Jan 4, 2020 at 20:31
  • nope, actually i resolved my issue so stopped searching for it @Oliver Jan 6, 2020 at 10:36
30

Using Google Play app signing feature & Google APIs integration in your app?

  1. If you are using Google Play App Signing, don't forget that release signing-certificate fingerprint needed for Google API credentials is not the regular upload signing keys (SHA-1) you obtain from your app by this method:

Upload signing certificate

  1. You can obtain your release SHA-1 only from App signing page of your Google Play console as shown below:-

If you use Google Play app signing, Google re-signs your app. Thats how your signing-certificate fingerprint is given by Google Play App Signing as shown below:

App Signing page - Google Play Console

Read more How to get Release SHA-1 (Signing-certificate fingerprint) if using 'Google Play app signing'

0
26

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

3
  • got error missing keystore Oct 25, 2021 at 10:28
  • @Adnanhaider have you tried all steps carefully ? Its valid in latest version of android studio. If you are using old version then open gradle then app and then android and last click of signing report Oct 25, 2021 at 10:57
  • 1
    my bad i used release config that's why i got error. now its work fine thanks Oct 25, 2021 at 11:00
20

from a Debug Keystore we can get the SHA1 value in Eclipse. Accessing from the menu: Window -> Preferences -> Android -> Build

but it doesn´t work for a production Keystore. enter image description here

So, to get the SHA1 value from a production Keystore go to: Android Tools -> Export Signed Application Package. Follow the process for signing your apk and the SHA1 will showed as a certificate.

enter image description here

17

keytool is a key and certificate management utility. It allows users to administer their own public/private key pairs and associated certificates for use in self-authentication (where the user authenticates himself/herself to other users/services) or data integrity and authentication services, using digital signatures.

For Windows

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

Other

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

Authorization on Android uses a SHA1 fingerprint and package name to identify your app instead of a client ID and client secret.

enter image description here

http://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html

11

Best way ever with all steps:

For Release Keystore SHA1 Key:

  1. Open Command Prompt
  2. C:\Users\hiren.patel>cd..
  3. C:\Users>cd..
  4. C:\>cd "Program Files"
  5. C:\Program Files>cd Java
  6. C:\Program Files\Java>cd jdk_version_code
  7. C:\Program Files\Java\jdk_version_code>cd bin
  8. C:\Program Files\Java\jdk_version_code\bin>keytool -list -v -keystore "D:\Hiren Data\My Root Folder\My Project Folder\keystore_title.jks" -alias my_alias_name -storepass my_store_password -keypass my_key_password

Replace below thing:

  1. jdk_version_code
  2. D:\Hiren Data\My Root Folder\My Project Folder\keystore_title.jks
  3. my_alias_name
  4. my_store_password
  5. my_key_password

Done

0
11

In Gnu/Linux

First

You need key.jks, for example in my case this file it's in folder in /Desktop/Keys

/Desktop/Keys/key.jks

Second

cd /usr/lib/jvm/java-1.7.0-openjdk-amd64

Now you need excecute this command

keytool -list -v -keystore /PATH/file.jks -alias YourAlias -storepass *** -keypass ***

remplacing this fields

-keystore
-alias
-storepass
-keypass

For example

 keytool -list -v -keystore /home/david/Desktop/Keys/key.jks -alias MyAlias -storepass 456 -keypass 123

enter image description here

Good Luck!!

11

on the new update just go to Android folder and type ./gradlew signingReport

9

Step 1 : First locate your JDK's bin folder in your windows pc. See the image below.

Mine is :

C:\Program Files\Java\jdk1.8.0_131\bin

enter image description here

Step 2 : Now search for Command Prompt by typing "cmd" in windows 10 search bar. Then open Command Prompt as Administrator mode. See the image below:

enter image description here

Step 3 : Now copy this path and type it into Command Prompt

 C:\Program Files\Java\jdk1.8.0_131\bin

enter image description here

In Command Prompt :

cd C:\Program Files\Java\jdk1.8.0_131\bin

enter image description here

After pressing Enter button you will go to the bin folder.

enter image description here

Your setup is done. Now generate your SHA1 key for Release mode.

Release SHA1 Key :

keytool -list -v -keystore C:\Users\Turzo\Desktop\earninglearning.keystore -alias turzo -storepass 12345678 -keypass 12345678

enter image description here

1
  • Screenshots were quite helpful Aug 1, 2020 at 6:39
8

First there is same .jar file that in fb-sdk android-support-v4.jar.
Then generate SHA1 key using:

PackageInfo info;
try {

    info = getPackageManager().getPackageInfo(
        "com.example.worldmission", PackageManager.GET_SIGNATURES);

    for (Signature signature : info.signatures) {
        MessageDigest md;
        md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        String something = new String(Base64.encode(md.digest(), 0));
        Log.e("Hash key", something);
        System.out.println("Hash key" + something);
    }

} catch (NameNotFoundException e1) {
    Log.e("name not found", e1.toString());
} catch (NoSuchAlgorithmException e) {
    Log.e("no such an algorithm", e.toString());
} catch (Exception e) {
    Log.e("exception", e.toString());
}
1
  • 3
    Nothing to do with certificates whatsoever.
    – user207421
    Dec 1, 2015 at 10:06
8

enter image description here

Right side Gradle --> signing project get all keys

0
8

If you are using Android Studio IDE then you can get SHA1 has value for your all build variants with one click.

Under Gradle Projects Window > Select Root Project > signingReport > double click

File Navigation

Next

Open Run Window

Go To Variant: release for release

Go To Variant: debug for debug

2
  • I do it but i dont got the SHA for release !
    – Oliver D
    Jan 4, 2020 at 20:33
  • 2
    Please make sure you have added sign in credential in the sign in configuration under release block in gradle. Otherwise it wont show release sha key Jan 5, 2020 at 5:27
7

Open Command Prompt in Windows and go to the following folder .

C:\Program Files\Java\jdk1.7.0_05\bin

Use commands cd <next directory name> to change directory to next. Use command cd .. to change directory to the Prev

Now type the following command as it is :

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
1
  • After battling with this issue for SEVERAL hours, your answer saved my app's life. THANKS!!!!
    – Emzor
    Mar 27, 2020 at 9:11
7

//the simplest way to get SHA1

//add following command to your terminal and hit enter

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

You can get MD5 and SHA1 fingerprint for any workspace by going to Window>Preference>Android>Build in Eclipse.

1
  • 1
    this will do the job instead of going through the hassle of exporting and using CMD Dec 5, 2014 at 4:57
6

In Addition to Lokesh Tiwar's answer

For release builds add the following in the gradle:

android {

defaultConfig{
//Goes here
}

    signingConfigs {
        release {
            storeFile file("PATH TO THE KEY_STORE FILE")
            storePassword "PASSWORD"
            keyAlias "ALIAS_NAME"
            keyPassword "KEY_PASSWORD"
        }
    }
buildTypes {
        release {
            zipAlignEnabled true
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

Now running the signingReport as in Lokesh's Answer would show the SHA 1 and MD5 keys for the release builds as well.

Sample

1
  • you are the boss!! :)
    – mhdjazmati
    Jan 20, 2021 at 16:42
6

This solution is for android studio 3.5 version:

  1. Open your project into Android studio.
  2. Click on Gradle tab on right side.
  3. Will see two things one is our project(root) and just app.
  4. Select our project in your case it might be your app.
  5. Right click on the project and refresh it.
  6. Then click on the the project drop don button.
  7. Click on the Tasks where will see android folder.
  8. Double Click on signingReport and will see the details in Run console.
5

As of Sept 2020, if you want to get the SHA-1 fingerprint of keystore certificate of Release. Simply open up your Google Play Developer Console and open the App Signing tab.

enter image description here

0
4

If you are using android studio use simple steps:

  • Run your project

  • Click on Gradle menu

  • Expand Gradle task tree

  • Click on android-> signingReport

enter image description here If there is nothing displayed(android studio 2.2) then

Click on Toggle tasks execution/text mode from Run bar

1
  • 1
    bro in the current version it will maybe not work. Jul 26, 2021 at 5:47
4

I had a problem during opening with command

[keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test]

Therefore, i download https://sourceforge.net/projects/portecle/. Then just open .jks file from the jar program. it will show you all relevant information

snapshot of the program

0
4

Easy method - with Keystore explorer

Follow the step

  1. Download keystore explorer Download link
  2. Install keystore explorer
  3. Open keystore via keystore explorer
  4. Enter password
  5. Click your keystore name
  6. then you will get the sha1 key

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