SHA-1 fingerprint of keystore certificate

874,160

Solution 1

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

Solution 2

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

Solution 3

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

Solution 4

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 

Solution 5

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

enter image description here

Share:
874,160
user2208349
Author by

user2208349

Updated on May 07, 2022

Comments

  • user2208349
    user2208349 about 2 years

    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?

    • Poras Bhardwaj
      Poras Bhardwaj over 8 years
      Hope this link will help you. stackoverflow.com/questions/12214467/…
    • Naeem Ibrahim
      Naeem Ibrahim over 7 years
      Easiest way to Get SHA-1 For Release and Debug mode android studio gradle. Check this
    • Akhilesh Sinha
      Akhilesh Sinha over 6 years
      run this command in your terminal: keytool -exportcert -list -v \ -alias androiddebugkey -keystore ~/.android/debug.keystore. It will ask for your keystore password. which you can find from the file named "debug.keystore.properties" in the android/keystore folder
    • KKSINGLA
      KKSINGLA over 3 years
  • Jay Sidri
    Jay Sidri over 9 years
    ~/ is your home directory in *nix systems. Under Windows, just use %USERPROFILE%
  • Jay Sidri
    Jay Sidri over 9 years
    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
  • ssj3goku878
    ssj3goku878 over 9 years
    this will do the job instead of going through the hassle of exporting and using CMD
  • Vincent
    Vincent over 8 years
    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.
  • LairdPleng
    LairdPleng over 8 years
    My 'gradle projects' window is empty... any ideas why that might be?
  • Lokesh Tiwari
    Lokesh Tiwari over 8 years
    It will appear once you run the project either in emulator or on device
  • LairdPleng
    LairdPleng over 8 years
    Yea I tried that but nothing happened. Seems as though, in my case, I had to press the 'refresh' button before anything showed up!
  • user207421
    user207421 over 8 years
    Nothing to do with certificates whatsoever.
  • danypata
    danypata about 8 years
    For all Android devs, this is quite an easy way to find the SHA1. Nice finding man.
  • Anwar Hossain
    Anwar Hossain almost 8 years
    is sha1 key same for all the apps? or different for every app?
  • Lokesh Tiwari
    Lokesh Tiwari almost 8 years
    @anwar Hossain Every time you generate SHA1 It can be different every time irrespective of app. I have tried two different days it has given me different
  • danypata
    danypata almost 8 years
    @LokeshTiwari I think on Android Studio 2.1 the signReport task is in Tasks -> android
  • عثمان غني
    عثمان غني almost 8 years
    how to get release sha1. I am getting it from my app.jks but console.google is showing its already used.
  • OneCricketeer
    OneCricketeer almost 8 years
    How is your answer different than those provided? stackoverflow.com/a/38369406/2308683
  • Lokesh Tiwari
    Lokesh Tiwari over 7 years
    @AdnanAli Thank you for pointing out. Yes it is available in 2.2 but use Toggle button in Run Console check updated pic
  • portfoliobuilder
    portfoliobuilder over 7 years
    Where can I find the equivalent on Android Studio? My IDE is pointing to the wrong SHA1
  • portfoliobuilder
    portfoliobuilder over 7 years
    How to change the location? I know how to change to a different keystore when signing, but what about the default one?
  • Maveňツ
    Maveňツ over 7 years
    plus 1 for toggle task execution/text mode :D
  • gpuser
    gpuser over 7 years
    Another way you can get this certification detail for debug mode from (1)Right click on Gradle bar at android studio (2)then click on app -> Tasks -> android -> signingReports then on Gradle console you will get the reports
  • Irfan Raza
    Irfan Raza over 7 years
    It now appears under "Gradle Console" tab from Android studio 2.2.3
  • Shirish Herwade
    Shirish Herwade over 7 years
    very detailed answer with images, helps a lot... very easy to understand than other answers here... up-vote for the images in answer
  • Napolean
    Napolean about 7 years
    $ keytool -list -v -keystore ~/.android/debug.keystore -storepass android only this also works
  • statosdotcom
    statosdotcom about 7 years
    Agree: best option. "Plused" one. I missed a l little bit more text information, but the main path you've shown. Thank you.
  • pblead26
    pblead26 about 7 years
    The google Maps activity idea is the BEST. Thank you
  • Sushant Patekar
    Sushant Patekar almost 7 years
    1)You have to double click on the filename.
  • Shihab Uddin
    Shihab Uddin almost 7 years
    If your alias key have space like "App Moon" then add double quation "App Moon" as alias name.
  • Lokesh Tiwari
    Lokesh Tiwari over 6 years
    @onexf go to build variants >> change debug to release
  • Himanshu arora
    Himanshu arora over 6 years
    Look at this to get SHA-1 key using android studio. easybook4u.com/index.php/2017/08/25/…
  • ban-geoengineering
    ban-geoengineering over 6 years
    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?
  • ban-geoengineering
    ban-geoengineering over 6 years
    ...solution to my Run problem here: stackoverflow.com/a/48283047/1617737 .
  • Valentin Yuryev
    Valentin Yuryev over 6 years
    It's the best solution for Android Developers who work on Windows because keytool is not works in Windows console.
  • Ankur Shah
    Ankur Shah almost 6 years
    do you also know how to remove it?
  • Emil
    Emil almost 6 years
    your solution is working fine. why the heck, google official documentation doesnt work? coment defiined here wont execute and return error. developers.google.com/android/guides/client-auth
  • Harsha
    Harsha almost 6 years
    after generating releasemode api key for sha1 for google places api for android place picker map opened and closed immediately.In log showing forbidden error 403 please help me
  • Harsha
    Harsha almost 6 years
    here showing 2 signin certificates appsignin and uploaded signincertificates.which one i need to use for release
  • Eaweb
    Eaweb over 5 years
    Works fine, thanks for this answer. However, I am curious if I can use this to get SHA1 for release key of my app. (the default is debug key)
  • Abhishek Mehandiratta
    Abhishek Mehandiratta over 5 years
    A true savior! I don't know why the SHA-1 key was different when generated from command prompt and android studio.
  • ParSa
    ParSa almost 5 years
    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
  • Sanket Patel
    Sanket Patel over 4 years
    it shows sha1 for debug, is this same for release variant also ?
  • Oliver D
    Oliver D over 4 years
    @SanketPatel are u got the release SHA1?
  • Oliver D
    Oliver D over 4 years
    I do it but i dont got the SHA for release !
  • Jayakrishnan
    Jayakrishnan over 4 years
    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
  • Sanket Patel
    Sanket Patel over 4 years
    nope, actually i resolved my issue so stopped searching for it @Oliver
  • Emzor
    Emzor about 4 years
    After battling with this issue for SEVERAL hours, your answer saved my app's life. THANKS!!!!
  • ßiansor Å. Ålmerol
    ßiansor Å. Ålmerol about 4 years
    For release you need to use the App signing certificate
  • Jaichander
    Jaichander about 4 years
    Thanks,Saved my Day
  • MMG
    MMG about 4 years
    Give example for debug please
  • Gilian Marques
    Gilian Marques almost 4 years
    I just created a .bat for convenience: ??@echo off ??title SHA-1 from release keystore ??color 0a ??cd C:\Program Files\Android\Android Studio\jre ??set /p keystorePath= Set the path to the keystore here (just drag it here): ??set /p alias= Enter the keystore alias: ??echo : ??echo : ??echo : ??keytool -list -v -keystore %keystorePath% -alias %alias% ??echo : ??echo : ??echo : ??set /p cmd=Press any key to exit Create a .bat file, paste this code, replace the "??" by line breaks and change JRE path if needed.
  • Akshay Sahai
    Akshay Sahai almost 4 years
    Screenshots were quite helpful
  • greybeard
    greybeard over 3 years
    There are archive snapshots of the tutorial referenced above.
  • mhdjazmati
    mhdjazmati over 3 years
    you are the boss!! :)
  • Kleber
    Kleber about 3 years
    Just for future reference: make sure you point to ~/.android/debug.keystore file. As I already had a keystore file, I thought I should reference it or create a new one in order to make this command work properly.
  • Vishal Beep
    Vishal Beep almost 3 years
    this is a very lengthy process.
  • Vishal Beep
    Vishal Beep almost 3 years
    bro in the current version it will maybe not work.
  • Adnan haider
    Adnan haider over 2 years
    got error missing keystore
  • Rahul Kushwaha
    Rahul Kushwaha over 2 years
    @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
  • Adnan haider
    Adnan haider over 2 years
    my bad i used release config that's why i got error. now its work fine thanks
  • Braj
    Braj about 2 years
    thanks I used password as "android" that solved this issue