Reputation: 13724
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?
Upvotes: 202
Views: 472332
Reputation: 722
If you are using Windows and you are using VS code inside Windows, then follow these steps.
Open terminal inside VS code and put these commands inside the terminal
cd android
./gradlew signingReport
Upvotes: 1
Reputation: 24068
In my case, adding signing keys in the firebase console alone didn't fix the issue.
I had forgotten to enable Google authentication as a sign in method in the firebase console under "Authentication" tab. Once Google authentication enabled, it started working as expected.
Upvotes: 0
Reputation: 125
For windows user with flutter
run the command below in your project terminal
cd android
then run this command
./gradlew signingReport
Upvotes: 6
Reputation: 19572
I'm using a Mac and Android Studio Dolphin 2021.3.1 Patch 1.
None of the answers with visual directions worked for me because when I pressed the gradle/elephant in the upper right hand corner of Android studio, there were only 2 paths MyPojectName/app. Everyone else's has more paths underneath however mines only has 2.
When I pressed the elephant (Execute Gradle Task
) and I typed in signingReport
nada. I looked through the list but it wasn't there.
When I opened Terminal in Android studio and entered gradlew signingReport
nothing found. Then I tried ./gradlew signingReport
and still nothing.
Long story short it only took 2 easy steps to find the keys. I first followed this answer:
1- Android Studio
/Preferences
/Build,Execution,Deployment
/Build Tools
/Gradle
. In the right panel click the Gradle JDK
dropdown then select Download JDK
2- After that finished, while in Android Studio I opened Terminal
In there I followed R7G's answer (his answer didn't work at first without step 1) and entered this into terminal (bottom of Android Studio):
bash ./gradlew signingreport
And like that, both keys appeared
Another option is to add Gradle either using Homebrew
brew install gradle
To find where gradle is located on mac
Another option is to run gradle wrapper
and follow the prompts
Upvotes: 3
Reputation: 3049
This is the easiest way-
Open Android Studio
Open Project
Reveal android folder
Right click "gradlew" file and select Open in Terminal -
gradlew signingReport
or ./gradlew signingReport
if you're using PowerShell or a Unix-based system like mac.Upvotes: 295
Reputation: 4387
Working solution in 2022 for all Android apps including React Native and Flutter. If you need to see SHA-1 certificate code but all other options did not work, you can try this. Suggested solutions like running commands from Command Line and other suggested ways through Android Studio was giving this error: could not open `C:\Program Files\Android\Android Studio\jre\jre\lib\amd64\jvm.cfg'. No need to unistall Java, remove java files or play with system path values as mentioned by others.
Here is how you can get it work:
Note: If you see this error Task 'signing' is ambiguous in root project... Candidates are...
you need to clean the project(Top level menu Build
--> Clean Project
) first and then run this gradle signingReport
again.
Upvotes: -1
Reputation: 3863
1. Locate your android directory inside the console
E:\<appname>\android>
2. After locating to the android folder run this command
./gradlew signingReport
1. Type signingReport
in daemon terminal
daemon> signingReport
This would be taking a bit long time to generate your first SHA-1 as it would be checking for all the firebase dependencies and after that over it generate the SHA-1.
Upvotes: 12
Reputation: 329
If you are using flutter I hope it will work for you,
If you are using vs code then open terminal or if you are using other stuff then Goto the project folder and open terminal and past below code
keytool -list -v -keystore "C:\Users%your user name%.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
It's work for me. i think will work for you also.
Upvotes: 0
Reputation: 519
Solution for Windows Flutter 2022-23 solution to get SHA-1
First solution:-
In your project terminal type cd android
now you're inside the android folder now type ./gradlew
then type
gradlew signinReport
IF you got this error then try next solution
second solution
cd android
in your root project./gradlew signingReport
you will surely get SHA-1
Upvotes: 0
Reputation: 209
1-write those two commands in android studio's or vscode terminal:
cd android
gradlew signingReport
2-wait a bit then scroll up.
in linuix
cd android
./gradlew signingReport
Upvotes: 17
Reputation: 540
For Mac Users
If after typing ./gralew signingReport inside android folder gives you this error:
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
Then follow this process:
/Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
.You are done, you will see the keys now.
Upvotes: 1
Reputation: 1060
This solution work for me in MAC os Monterey and Android studio Bumblebee
open the android folder in terminal
right click on Android folder>Open In>Terminal
it will open new terminal window and run below command
bash ./gradlew signingreport
Upvotes: 6
Reputation: 825
you can do the same on VSCode, open the folder that contain gradlew for linux and gradlew.bat for windows and run ./gradlew signingReport
for Window and run gradlew signingReport
for Linux
Upvotes: 18
Reputation: 503
try writing this in Terminal - For Windows
cd android
gradlew signingReport
Upvotes: 1
Reputation: 12287
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.
Upvotes: 374
Reputation: 4998
If you have the keystore file, then run keytool -list -v -keystore fileName.jks -alias upload -storepass password -keypass password
at the keystore file location...
Upvotes: 3
Reputation: 2501
For Android Studio 4.2 and Flutter 2.2
Windows:
Open your project open android > gradlew > right click on it and click open in terminal
Like below:
My Project Directory: D:\AndroidStudioProjects\WowTalentNew\android>gradlew
open this in terminal.
After build finished execute this
D:\AndroidStudioProjects\YourProjectDirectory\android>gradlew signinReport
After that you will see the SHA keys
Here's my full CMD screen
Microsoft Windows [Version 10.0.19043.985]
(c) Microsoft Corporation. All rights reserved.
D:\AndroidStudioProjects\WowTalentNew\android>gradlew
> Configure project :app
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
> Task :help
Welcome to Gradle 6.3.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see a list of command-line options, run gradlew --help
To see more detail about a task, run gradlew help --task <task>
For troubleshooting, visit https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle
7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See
BUILD SUCCESSFUL in 6s
1 actionable task: 1 executed
D:\AndroidStudioProjects\WowTalentNew\android>gradlew signinReport
> Configure project :app
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
> Task :app:signingReport
Variant: debugAndroidTest
Config: debug
Store: C:\Users\apoor\.android\debug.keystore
Alias: AndroidDebugKey
MD5: 2A:97:87:DF:E1:58:D4:9D:E6:65:18:********
SHA1: 4E:0E:D0:F7:68:51:80:47:3E:D1:**************************
SHA-256:
17:83:42:F4:0E:59:C5:5B:1E********************************************************
BC:79
Valid until: Saturday, November 26, 2050
in Linux instead of just type gradlew we write ./gradlew to build. and to get SHA-1 we write: Terminal> ./gradlew signinReport and we could just build and get SHA-1 key with just one command: Terminal> ./gradlew signinReport
I hope it clears everything, happy coding!
Upvotes: 14
Reputation: 147
You can use one line in terminal
echo y | keytool -genkeypair -dname "cn=Chris, ou=JavaSoft, o=Sun, c=US" -alias business -keypass kpi135 -keystore /working/android.keystore -storepass ab987c -validity 20000
Upvotes: 0
Reputation: 1593
so if you are using an android studio or VS code it's work both of them
=> 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
Upvotes: 50
Reputation: 4575
1. First Methord just run the below command
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
2. Second Methord
1. Left side open the android folder not the whole project in android studio.
2. Right Side open the file android/app/Tasks/anroid/signingReport
Final this process will take some time and it might be of 5-10 minutes so be patient
Upvotes: 8
Reputation: 341
To get generate a SHA-1 key
in the terminal type cd android
and change the path then type ./gradlew signingReport
Upvotes: 2
Reputation: 656
go to the android folder in terminal
cd android .\gradlew signingReport
it will generate your SHA1 and SHA256 for you
Upvotes: 3
Reputation: 2165
run this commend it work any where
in android folder
./gradlew signingReport
for example
PS E:\flutterProject\flutter_app\android> ./gradlew signingReport
some time you not need add ./ just
gradlew signingReport
this work for android studio and cmd and commond prome
Upvotes: 39
Reputation: 4740
Flutter Project Using MAC & VS Code
https://services.gradle.org/distributions/gradle-6.3-all.zip
.\gradlew signinReport
you will get the signing report Like this :
Upvotes: 1
Reputation: 4844
Method 1
Method 2
keytool -list -v -alias androiddebugkey -keystore C:\Users\YOURUSERNAME\.android\debug.keystore
Upvotes: 3
Reputation: 5283
First, check which Keystore is being used by your project in
Then use the below command
keytool -list -v -alias mstoreappsemoAlias -keystore fluxstorepro/android/app/mstoresemoFile.keystore
and if you want to generate a hash key for Facebook then use the below command
keytool -exportcert -alias mstoreappsemoAlias -keystore fluxstorepro/android/app/mstoresemoFile.keystore | openssl sha1 -binary | openssl base64
Upvotes: 2
Reputation: 3264
Personally, I went to the terminal then navigated to C:\Program Files\Java\jdk-14.0.2\bin (navigate to your java bin folder).
Next, I ran this command and it worked: keytool -list -v -keystore "%USERPROFILE%.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Upvotes: 0
Reputation: 3517
I found that I needed to check the fingerprint in Google Play Console, since I have Google Play managed app signing.
The ones provided by gradlew did not work for me.
Note that you can put both in Firebase, but you only need one. I just added the SHA1 and Google Sign In began working.
Upvotes: 0
Reputation: 1246
for linux:
/home/alif/Documents/project/flutter/fit_app/android/gradlew
).../android gradlew signinReport
and hit entergood luck!
Upvotes: 0
Reputation: 4857
I partially agree with Rishab answer, but what we can do is
and this approach works with all flutter/React-native/Android
....
Navigate to Android folder inside project, there is gradlew file. so we can use this like :
gradlew signingReport
in Mac
./gradlew signingReport
in my case i use it like :
D:\flutter\flutter_app\android>gradlew signingReport
Project Architecture is :
Upvotes: 129