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.
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
You will need the following:
- Key and Certificate Management Tool (
keytool
) from the Java Development Kit openssl-for-windows
openssl library for Windows from the Google Code Archive
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
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64
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
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.
This is the easiest way-
Open Android Studio
Open Project
Reveal android folder
Right click "gradlew" file and select Open in Terminal -
- 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)
- Press enter and scroll to "Variant: debug" to get the SHA1 key
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.
- Select android/app/build.gradle file and on the right top corner click "Open for Editing in Android Studio"
- Open Gradle panel and double click on "SigninReport",
- 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.
=> Open Terminal
=> cd android
=> signingReport
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
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