Generate SHA-1 for Flutter/React-Native/Android-Native app
TERMINAL
Go to the project folder in the terminal.
Mackeytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Windowskeytool -list -v -keystore "\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Linuxkeytool -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",
see Android studio Gradle Tab
- 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.
How to Get SHA-1 key in React Native cli?
Windows:
– Open a terminal window– Change the directory to the JDK bin directory. The path of the JDK depends upon the operating system you are using
cd C:\Program Files\Java\jdk1.8.0_121\bin
– Now we have to run the following command using the keytool.exe file in JDK/bin
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Ubuntu/Mac
– Open a terminal window
– Now run the following command
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
For more details click Here
From React-native Project:
– Run this command in React-Native App directorycd android && ./gradlew signingReport
– copy the SHA1 from the debug key (This generates two variant keys. You can copy the 'SHA1' that belongs to the debugAndroidTest variant key option.)
How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
Easiest ways ever:
Update added for Android Studio V 2.2 in last step
There are two ways to do this.
1. Faster way:
- Open Android Studio
- Open your Project
- Click on Gradle (From Right Side Panel, you will see Gradle Bar)
- Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)
- Click on Your Project (Your Project Name form List (root))
- Click on Tasks
- Click on Android
- Double Click on signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console))
- Select app module from module selection dropdown to run or debug your application
Check the screenshot below:
2. Work with Google Maps Activity:
- Open Android Studio
- Open Your Project
- Click on File menu -> Select New -> Click on Google -> Select Google Maps Activity
- A dialog would appear -> Click on Finish
- Android Studio would automatically generate an XML file named with
google_maps_api.xml
- You would get debug SHA1 key here (at line number 10 of the XML file)
Check Screenshot below:
Android Studio V 2.2 Update
There is an issue with Execution.
Solution:
- Click on Toggle tasks execution/text mode from Run bar
Check Screenshot below:
Done.
how to get sha1 of android app in Vs code
Open a terminal window.
Change the directory to the JDK bin directory, mine was jdk1.7.0_05 (could be different for you).
cdC:\Program Files\Java\jdk1.7.0_05\bin
Next we have to run the keytool.exe. Use the following line to get the Android SHA1 fingerprint.
Windows:keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore"-alias androiddebugkey -storepass android -keypass android
Mac and Linux:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
SHA-1 fingerprint of keystore certificate
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
How do I generate SHA-1 for Flutter app from Linux command line
Run gradlew signingReport
from the android
directory under the root of your flutter project:
myflutterproject/android$ ./gradlew signingReport
This assumes you have JAVA_HOME and PATH to bin directory set.
If you do not have the full JDK installed, the location of the Java Runtime Environment (JRE) embedded with Android Studio can be found by running:
$ flutter doctor -v
With a default Android Studio installation the location of the JRE should be:
/opt/android-studio/jre/bin/
To set the JAVA_HOME
environment variable and PATH to the bin directory, add the following lines to your ~/.bashrc
file:
export JAVA_HOME=/opt/android-studio/jre
export PATH=$PATH:$JAVA_HOME/bin
(Close and reopen the terminal window before use)
Related Topics
Self-Signed Ssl Acceptance on Android
Android Starting Service At Boot Time , How to Restart Service Class After Device Reboot
How to Animate Recyclerview Items When They Appear
Generate Sha-1 for Flutter/React-Native/Android-Native App
How to Set My App as the Default Sms App
Custom Toast on Android: a Simple Example
How to Get the Actionbar Height
Getinstance() Doesn't Work with Other Location Than Us-Central1 in Realtime Database
Android: Detect When Scrollview Stops Scrolling
Receive Result from Dialogfragment
Clicking Urls Opens Default Browser
How to Change the Floating Label Color of Textinputlayout
How to Align Views at the Bottom of the Screen
Differencebetween Min Sdk Version/Target Sdk Version VS. Compile Sdk Version
Passing Image from One Activity Another Activity
Benefit of Using Parcelable Instead of Serializing Object
How to Store(Bitmap Image) and Retrieve Image from SQLite Database in Android
How to Display the Current Value of an Android Preference in the Preference Summary