Setu Kumar Basak
Setu Kumar Basak

Reputation: 12022

How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?

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?

Upvotes: 747

Views: 1171820

Answers (30)

Shubham
Shubham

Reputation: 76

This is Quickest way to get SHA-1 in Android studio - Follow steps below:

  1. Open Terminal in Android Studio
  2. Run the following command:

./gradlew signingReport

  1. Check the terminal output.

The SHA-1 for both debug and release build types will be displayed, along with other details like SHA-256 and MD5.

Upvotes: 3

Rahul Kushwaha
Rahul Kushwaha

Reputation: 6742

----------------------------------------EDITED 2024--------------------------------------

For the latest Android versions 2024.1.1 and latest.

  1. Search for gradle icon enter image description here

  2. Search for "Execute Grade Task" Terminal.As seen in image .enter image description here

3)Click on it and write the command "gradle signingreport". And Your signing result for Debug and Release will be generated. enter image description here

--------------------------------------------------------Old------------------------------------------------

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 Or For Newer Android Studio sha12

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 want to get SHA KEY for Flutter/ React native projects. Follow these steps:--

1)Open Android Folder

open android folder

2)Click on gradlew and Open it in Terminal

enter image description here

3)Type the command "./gradlew signingreport" and you will get the SHA KEY for different Varient and Config

enter image description here

Upvotes: 396

Divyang Rana
Divyang Rana

Reputation: 31

Get SHA1 and SHA-256 fingerprint certificate in Android Studio/Flutter

In Flutter

Step 1 : go to Android -> app -> build.gradle -> open for editing in Android studio

enter image description here

Step 2 : Click on Gradle -> Execute Gradle Task -> write gradle signingReport

enter image description here

enter image description here

Upvotes: 2

Hamdy Abd El Fattah
Hamdy Abd El Fattah

Reputation: 1827

One line to get it.

In the terminal type this command

gradle signingReport

very important

press Ctrl + enter ⚠ not enter only

Work with Mac And Windows

Upvotes: 40

Anand Nishad
Anand Nishad

Reputation: 126

open the Android Studio terminal and type this command -

./gradlew signingreport

enter image description hereenter image description here

Upvotes: 4

Sunnat Amirov
Sunnat Amirov

Reputation: 171

I tried almost all the ways which were given by other developers, but it was not successful. I run :

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

Which is for Windows. But I got error message saying: 'keytool' is not recognized as an internal or external command, operable program or batch file. Then I download JDK (Java Development Kit) for running this command. I updated my path also. Here is the steps how you can do that:

  1. Open the System Properties window.

  2. Click on the Advanced tab.

  3. Click on the Environment Variables button.

  4. In the System variable section, scroll down and find the PATH variable.

  5. Click on the Edit button.

  6. In the Edit environment variable dialog box, add the path to the keytool executable to the Value field. The path is usually something like C:\Program Files\Java\jdk-20\bin.

  7. Click on the OK button to close the Edit environment variable dialog box.

  8. Click on the OK button to close the Environment Variables dialog box.

  9. Close the System Properties window. Then I run the same command:

    keytool -list -v
    -alias androiddebugkey -keystore %USERPROFILE%.android\debug.keystore This time I got another error message:

New Error Message

Finally I changed command to this :

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

This worked for me. SSH keys

Upvotes: 0

Omar
Omar

Reputation: 676

The easiest way is

  1. From left side click on project folder >> android then right-click on gradlew folder and select open in terminal

  2. paste it into terminal './gradlew signingReport'

    Good Luck

Upvotes: 11

Divyesh Kevadiya
Divyesh Kevadiya

Reputation: 51

Here is the full process to generate SHA-1 and MD5 key in latest - 2023 android studio.

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 1

Rezaul Karim
Rezaul Karim

Reputation: 1349

Steps:

  1. File
  2. Settings
  3. Experimental
  4. Unchecked the 'Do not build gradle task list during gradle sync' Or Unchecked 'Only include test tasks in the Gradle task list generated during Gradle Sync' and click 'OK'
  5. Go to file
  6. Sync project with Gradle files
  7. You will see the option on Signing reports under: Gradle -> Tasks ->Android -> Signing Report.
  8. Check the image below

enter image description here

Upvotes: 0

artenson.art98
artenson.art98

Reputation: 1605

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

Update for Android Studio Flamingo:

Option name changed

The option namely Only include test tasks in the Gradle task list generated during Gradle Syncs that needs to be unchecked will look this:

enter image description here

Upvotes: 70

Amal
Amal

Reputation: 321

In Mac

keytool -list -v -keystore ~/Desktop/AppRelease/FolderName/app_key -alias userName -storepass pw -keypass pw 

Upvotes: 1

Rajesh Satvara
Rajesh Satvara

Reputation: 3964

For me I was not getting signing report option in my android studio so I found very easy way to get SHA-1.

in terminal(of Android studio) execute this line :

./gradlew signingReport

Upvotes: 6

Jorgesys
Jorgesys

Reputation: 126563

Use 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


Other option using the terminal of Android Studio, using windows type :

.\gradlew signingReport

Very important press Ctrl + enter (Dont use only enter)

The you will get the SHA1 in the output

----------
Variant: IrinaIoanaDebugAndroidTest
Config: debug
Store: C:\Users\jorgesys\.android\debug.keystore
Alias: AndroidDebugKey
MD5: 12:D6:14:D5:87:CE:12:CC:8D:50:5D:CB:0E:D7:0B:3E
SHA1: 12:48:1F:75:26:E6:E2:D7:25:85:80:70:97:79:0A:5F:78:F7:51:7B
SHA-256: 12:5B:15:87:5E:E4:12:ED:79:DF:5E:B6:4B:9D:1E:FE:90:8C:67:FC:65:A8:53:79:54:02:98:22:6B:33:1E:6F
Valid until: Wednesday, September 11, 2052
----------

Upvotes: 11

Delmontee
Delmontee

Reputation: 2364

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

Upvotes: 52

Abdul Waheed
Abdul Waheed

Reputation: 1022

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.

Upvotes: 15

UNREAL
UNREAL

Reputation: 506

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

Upvotes: 10

yveszenne
yveszenne

Reputation: 736

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

./gradlew signingReport

Upvotes: 21

Mustafa Al-Salhi
Mustafa Al-Salhi

Reputation: 123

You can open the terminal from the android studio and write this line:

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

Upvotes: 4

Jagar
Jagar

Reputation: 872

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 

Upvotes: 13

Renju Ashokan
Renju Ashokan

Reputation: 524

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

Upvotes: 7

Syed Rafaqat Hussain
Syed Rafaqat Hussain

Reputation: 1126

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.

Upvotes: 14

MD Jahid Hasan
MD Jahid Hasan

Reputation: 1113

Follow the following step

gradle(on the right corner) > click on your project name > Tasks > android > double click on signingReport

Then you will get SHA1 and other information in 4:Run(it will appear automatically).

Upvotes: 0

narcis dpr
narcis dpr

Reputation: 1133

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.

Upvotes: 63

Arpit Patel
Arpit Patel

Reputation: 8067

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

enter image description here

Upvotes: 24

Sajas Mohammed
Sajas Mohammed

Reputation: 341

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

Upvotes: 2

Rachit Mishra
Rachit Mishra

Reputation: 29

First Step Go your C drive open Program File ->Open JAVA Folder ->Open Bin and DoubleClick on jarsigner.exe

Then Open Cmd

Go to C:\Program Files\Java\jdk1.8.0_191\bin Then Enter Then Go C:\Program Files\Java\jdk1.8.0_191\bin>keytool -list -keystore "F:\BTG UPDATE BUILD\Beyond_The_Game.jks"

Enter JUST Show Enter Kaystoer Password ***** enter your PAssword enter finally Your Release SHA key Getting you Thank YOU enter image description here

Upvotes: 1

Son Nguyen Thanh
Son Nguyen Thanh

Reputation: 1209

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.

Upvotes: 34

Kabir
Kabir

Reputation: 1489

  • Go 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.

Upvotes: 2

Vicky
Vicky

Reputation: 5136

For Linux & Mac

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

Upvotes: 29

JoeNCA
JoeNCA

Reputation: 2067

For Mac, this worked perfectly:

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

Upvotes: 195

Related Questions