How to add SHA-1 to android application

I'm trying to create a dynamic link in Firebase, when I'm selecting the android app, it shows an error saying "Add SHA-1 to this android app", I've already added a credential, but I'm not sure how exactly do I "add SHA-1 to the app"

How is this done?


Solution 1:

SHA-1 generation in android studio:

change firebase project setting

Press add fingerprint button


  1. Select Gradle in android studio from right panel

  2. Select Your App

  3. In Tasks -> android-> signingReport

Double click signingReport.

How to get sha1 fingerprint


You will find the SHA-1 fingerprint in the "Gradle Console"

Add this SHA-1 fingerprint in firebase console

Add SHA1 fingerprint

Solution 2:

If you are using Google Play App Signing you need to use the SHA1 from google play since Google will replace your release signing key with the one on googles server

enter image description here

Solution 3:

Alternatively you can use command line to get your SHA-1 fingerprint:

for your debug certificate you should use:

keytool -list -v -keystore C:\Users\user\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android

you should change "c:\Users\user" with the path to your windows user directory

if you want to get the production SHA-1 for your own certificate, replace "C:\Users\user\.android\debug.keystore" with your custom KeyStore path and use your KeystorePass and Keypass instead of android/android.

Than declare the SHA-1 fingerprints you get to your firebase console as Damini said

Solution 4:

MacOS just paste in the Terminal:

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

Solution 5:

for Updated Android Studio(12 May 2021)

  1. Click on Gradle right side
  2. Click on the elephant icon and type the command
gradle signingReport

press Enter

Now, you will see BUILD SUCCESSFUL in the Run window that you can open from bottom just scroll that window upward and you will find your SHA1 key there. Add this key to firebase

  1. In your Project settings, go to the Your apps card.
  2. Select the Firebase Android app to which you want to add a SHA fingerprint.
  3. Click Add fingerprint.
  4. Enter or paste the SHA fingerprint, then click Save.

At last, while running your App please check you change the run configuration to app else only the signingReport Task would be running again and again.