How to get SH1, and Key Hash

Way 1

To ensure the authenticity of the interactions between your app and Facebook, you need to supply us with the Android key hash for your development environment. If your app has already been published, you should add your release key hash too.

Generating a Development Key Hash
You'll have a unique development key hash for each Android development environment.
Mac OS
You will need the Key and Certificate Management Tool (keytool) from the Java Development Kit.
To generate a development key hash, open a terminal window and run the following command:
      
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

Windows
You will need the following:To generate a development key hash, run the following command in a command prompt in the Java SDK folder:
      
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" sha1 -binary | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" base64
      

This command will generate a 28-character key hash unique to your development environment. Copy and paste it into the field below. You will need to provide a development key hash for the development environment of each person who works on your app.
Generating a Release Key Hash
Android apps must be digitally signed with a release key before you can upload them to the store. To generate a hash of your release key, run the following command on Mac or Windows substituting your release key alias and the path to your keystore:
      
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64


Way2

get your sh1 using this command 

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

and convert it into hash using this website
  1. Copy the SHA1 in hex format and convert it in to base64 format, you can use this link http://tomeko.net/online_tools/hex_to_base64.php to do that without the SHA1:  part of the hex.


Way 3

This is the easiest way-

  1. Open Android Studio

  2. Open Project

  3. Reveal android folder

  4. Right click "gradlew" file and select Open in Terminal -

Open in Terminal

  1. Go to the terminal view and paste: gradlew signingReport

(edit based on Venkat D. suggestion below: on unix-based systems like mac, you need to specify the current directory like this- ./gradlew signingReport)

Paste

  1. Press enter and scroll to "Variant: debug" to get the SHA1 key

Scroll to key


Way 4

TERMINAL

Go to the project folder in the terminal.

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

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

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

GUI Android Studio.

  1. Select android/app/build.gradle file and on the right top corner click "Open for Editing in Android Studio"

enter image description here

  1. Open Gradle panel and double click on "SigninReport",

see Android studio Gradle Tab

enter image description here

  1. That's it! If you use Firebase - add these 2 keys there. You should add both keys, otherwise, without the release key, Google login will not work on the devices.

enter image description here


Way 5

=> Open Terminal

=> cd android

enter image description here

=> signingReport

enter image description here

and the final output like this as given in the image below choice your SSH key in at the place of here is your SSH key

enter image description here

in the above output, image is shown in dummy data I change some of the fields just because of security purpose

Edit: for mac

./gradlew signingReport


Post a Comment

Previous Post Next Post

Subscribe Us


Get tutorials, Flutter news and other exclusive content delivered to your inbox. Join 1000+ growth-oriented Flutter developers subscribed to the newsletter

100% value, 0% spam. Unsubscribe anytime