How to add SHA-1 to android application
SHA-1 generation in android studio:
Select Gradle in android studio from right panel
Select Your App
In Tasks -> android-> signingReport
Double click signingReport
.
You will find the SHA-1 fingerprint in the "Gradle Console"
Add this SHA-1 fingerprint in firebase console
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 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.
Get SHA-1 for Android Firebase
The issue is the slash (\
) in your command. Make sure it is all on one line and remove any slashes (\
). Also keep in mind that the command prompt interprets commands on a single line, so do not spread the command across multiple lines as it will treat everything on a new line as a different command. Put everything on one line.
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 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
How to add multiple SHA1 fingerprints to my Android App for testing?
Go to Google Cloud Platform Console or Firebase. You'll find the project there. Click on the project and you'll get into the dashboard of the same. In the bottom of the dashboard there'll be SHA key. Click add key and add the new key there. The Google Services which you have used in the app will run fine now.
Related Topics
Couldn't Load Memtrack Module Logcat Error
Android Activity Over Default Lock Screen
Changing Screen Brightness Programmatically (As with the Power Widget)
Mapview in a Fragment (Honeycomb)
Convert a PDF Page into Bitmap in Android Java
How to Create a File in Android
Difference Between Service, Async Task & Thread
What Is Different Between Mainactivity.This VS Getapplicationcontext()
Android: Out of Memory Exception in Gallery
What Exactly Does the Post Method Do
Finish All Activities at a Time
How to Build an APK File in Eclipse
In Eclipse, Unable to Reference an Android Library Project in Another Android Project
Is There Any Way in Android to Get the Height of Virtual Keyboard of Device