Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate SHA-1 for Flutter/React-Native/Android-Native app

I'm trying to generate a SHA-1 for a Flutter app, for Android studio to support Google Sign in, but I don't know how to do that, I saw some posts that indicate to run a command, but there I need a jks file I guess, and flutter doesn't create that.

Could someone help me?

like image 460
Joseph Arriaza Avatar asked Aug 14 '18 16:08

Joseph Arriaza


2 Answers

How to get Release and Debug keys: one more the easiest way (May 2019). All actions are inside 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

TERMINAL - another way with the terminal. In case you can't find the "Open for editing .." link.

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

like image 77
awaik Avatar answered Oct 09 '22 01:10

awaik


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

  1. Copy and use wherever you need it, Good Luck!
like image 26
Igal s Avatar answered Oct 09 '22 03:10

Igal s