Related
I tried to get my SHA-1 key by using the terminal but I don't know what problem is there, can anyone help me with this? I know how to get sha-1 key in android studio by signing report, but I want to generate in terminal.
Here is what I got when I run the command, I tried this answer but got nothing: how to get sha1 of android app in Vs code
above is my cmd. It is saying that it is an illegal option.
I have my Java bin directory here C:\Program Files\Java\jdk-14.0.2\bin and debug.keystore here: C:\Users\91819\.android
Put a space between "C:\Users\91819\.android\debug.keystore" and -alias
open the Project folder in VS code
Open the Terminal
Enter the following cmd and enter
keytool -list -v -keystore "C:\Users\yourusernamehere\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Replace yourusernamehere to your windows user name
you will get the SHA1 and other details.
I'm trying to retrieve the SHA-1 Fingerprint Certificate for my Flutter Project. This can usually be done going into the Gradle Panel on the right side in Android Studio and clicking on signingReport.
The problem is however, in Flutter, it doesn't show the Gradle Panel at all and after an hour of searching, I still couldn't find a way to get that panel to show.
I tried the Keytool way, but it tells me there's no such command in the Command Prompt. How do I get the SHA-1 Certificate for my flutter project? I need it for signing in my Flutter Project with Firebase Auth.
I've also searched in the Firebase Documentation, there is no documentation of how to find the SHA-1 in flutter. It simply says that SHA-1 is required for using Firebase Auth.
Related issue https://github.com/flutter/flutter/issues/24776
I had the same problem, to get the SHA-1 there are two ways:
Using Keytool (didn't work with me)
Using Gradle's Signing Report , which I used ,FIrst on terminal go to android folder with command:
cd android
and the following command to get the report:
./gradlew signingReport
then it will show the signingReport which you can retrieve the SHA-1 from it.
Are you saying that the following option (view Gradle panel) is not at all available?
Authenticating Your Client documents how to obtain your SHA-1 with keytool.
Use the command from Authenticating Your Client with Command Prompt:
keytool -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
If the command doesn't work, then include the path to keytool.exe. For me, that was C:\Program Files\Java\jdk-12.0.2\bin\keytool.exe. So the command I used was as follows:
"C:\Program Files\Java\jdk-12.0.2\bin\keytool.exe" -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
keytool -list -v -keystore c:\users\your_user_name\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
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?
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",
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.
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
Copy and use wherever you need it, Good Luck!
You won't find a gradle window view in flutter project, so here is a solution for that.. In command prompt navigate to bin folder of jdk and run this command
keytool -list -v -keystore "C:\Users\yourusernamehere\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
change user name in path
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 :
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
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
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
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
Simple and easy:
cd android && gradlew signinReport
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!
To generate SHA-1 for a Flutter :
1. Locate your android directory inside the console
E:\<appname>\android>
2. After locating to the android folder run this command
./gradlew signingReport
If this won't work and opens a daemon terminal
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.
Check this Authenticating Your Client | Google APIs for Android
To get the debug certificate fingerprint:
for Mac or Linux
keytool -list -v \ -alias androiddebugkey -keystore ~/.android/debug.keystore
for Windows
keytool -list -v \ -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
The default password for the debug keystore is android.
The keytool then prints the fingerprint to the terminal.
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
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
You can generate it even from terminal. Following is for the release mode:
keytool -list -v -keystore keystore_location -alias alias_name
example :
keytool -list -v -keystore /home/user/key.jks -alias alias_name
Method 1
Make sure java is installed in your system.
Method 2
Using Command-line change your username and run the below command
keytool -list -v -alias androiddebugkey -keystore C:\Users\YOURUSERNAME\.android\debug.keystore
the default password is android
go to the android folder in terminal
cd android
.\gradlew signingReport
it will generate your SHA1 and SHA256 for you
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
To get generate a SHA-1 key
in the terminal type cd android and change the path then type ./gradlew signingReport
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...
Flutter Project Using MAC & VS Code
Step One
Go To the Android Gradle Properties and add this line
https://services.gradle.org/distributions/gradle-6.3-all.zip
Step Two
Open the Terminal at android Folder of your Projects .
then in the terminal type
.\gradlew signinReport
you will get the signing report Like this :
try writing this in Terminal - For Windows
cd android
gradlew signingReport
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:
Run flutter doctor -v
Now inside the Android toolchain copy the location after Java binary at:. It will be something like this:
/Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
Paste it in the project's root location and Replace the java at the end of the above location with keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android.
You are done, you will see the keys now.
for linux:
if you are using vscode you can right-click on gradlew->copypath (in my case: /home/alif/Documents/project/flutter/fit_app/android/gradlew)
open your terminal and paste it, don't forget to delete /gradlew
type .../android gradlew signinReport and hit enter
good luck!
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.
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
gradlew signingReport
Use this command on Terminal which you can find in bottom left corner.
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
dname is a unique identifier for the application in the .keystore
cn the full name of the person or organization that generates the
.keystore
ou Organizational Unit that creates the project, its a subdivision of
the Organization that creates it. Ex. android.google.com
o Organization owner of the whole project. Its a higher scope than
ou. Ex.: google.com
c The country short code. Ex: For United States is "US"
alias Identifier of the app as an single entity inside the .keystore
(it can have many)
keypass Password for protecting that specific alias.
keystore Path where the .keystore file shall be created (the standard
extension is actually .ks)
storepass Password for protecting the whole .keystore content.
validity Amout of days the app will be valid with this .keystore
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
Again type cd android in your root project
Now type ./gradlew signingReport
you will surely get SHA-1
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.
I want to use assetlinks.json for appindexing.
I am supposed to use a SHA256 fingerprint, but when I print out the signingReport in Android Studio, I only have SHA1.
Can I use SHA1? If not, how can I get a SHA256 signed app?
Using Manish Jain's answer, I have managed to list only the debug keys. If I put my actual keystore path and jks file in the path:
keytool -list -v -keystore "C:\Users\myself\Keystores\android.jks" -alias mykey -storepass 1password -keypass 2password
A different set of keys come up, which I assume would be the release key set.
The BIG QUESTION is why Android Studio only lists the debug keys when I print out the signingReport from Gradle and why it says Variant: releaseUnitTest, Config: none? Any idea?
You can get SHA256 by using keytool using command prompt (windows).
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
For Mac users:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
If you have any special characters in your password, you may need to wrap the password in single quotes.
There is a much simpler and updated method to find it, comes from this answer.
Navigate to the Gradle tab at the right side of Android Studio.
In the list, navigate to the app section and expand it.
In the expanded list, navigate to the Tasks section and expand it.
Again, in the expanded list, navigate to the android section and expand it.
Double-click on signingReport, and find the SHA-256 Fingerprint at the Run box.
You will find your SHA-256 Fingerprint there.
As #quent commented, change your run configuration in the main toolbar to run the debug configuration again.
Go to the root directory of the project from the terminal and run the below command
./gradlew signingReport
You will get SHA-1, SHA-256, and other details
You can get it from the Google Play Console (https://play.google.com/apps/publish). Follow these steps:
Go to your project in GPC.
Expand "Release Management".
Go to "App signing".
Navigate to "App signing certificate".
Copy SHA-256 fingerprint.
I always find using ./gradlew signingReport effective and good for me.
Just run the command in your project terminal.
Navigate to the Gradle tab on the right side of Android Studio
Expand the project name
Expand Tasks
Expand Android
Double click on signingReport
As of 2021, in the latest Android Studio:
Navigate to the Gradle tab on the right side of Android Studio.
In the list, navigate to the app section and expand it. If you see the Tasks section in the expanded list, then follow this answer and you are good to go.
If you are not able to see the Tasks section then the alternate is:
Click the elephant button Execute Gradle Task on the upper left of the gradle tab, and then type in:
gradle signingReport
and it will print the SHAs in the console.
go to play console dashboard->App integrity ->app signing you will see SHA-1, SHA256 and MD5 keys
The tried solution: Upgrade your Gradle version
distributionUrl = https \: //services.gradle.org/distributions/gradle-5.4.1-bin.zip in gradle-wrapper.preperties
after that
Navigate to the Gradle tab on the right side of Android Studio
Expand the project name
Expand Tasks
Expand Android
Double click on signingReport
If you need it automated, you can extract the value from signingReport gradle task output like this:
function signing_certificate_digest() {
./gradlew app:signingReport | \
awk "/^Variant: $1\$/,/SHA-256|---/" | \
grep 'SHA-256' | \
cut -d' ' -f2
}
Which you can use like this in command line:
signing_certificate_digest debug
Also note:
When using Play App Signing, the signature of the binary signed by the upload key certificate will be different than the binary distributed by Google Play.
So this may not be suitable in that case.
Migrating OP's solution from the question to an answer:
For Release:
Go to: C:\Program Files\Java\jdk1.7.0_25\bin (or wherever your jdk file is).
Type cmd in address bar in win explorer.
Add: keytool -list -v -keystore "C:\Users\yourUserName\Keystores\android.jks" -alias yourAppName -storepass yourPasswordToKeystore -keypass yourPasswordToRequiredAppKey
Be careful!!!
If you have multiple keys in the keystore, it might not give you the
correct matching one to the given app!
Another way of getting the SHA256 for your app:
Either on the Developer Console or Firebase, you can find the related
SHA256 key somewhere. I couldn't find it now, but if you keep looking,
it is there somewhere.
I just found it on the Google Play Developer Console:
Upload the first version of your app (if you haven't done it yet)
Go to App Releases in Release Management
Click Manage Beta
At the APK version click the "i" info button on the right
It will show you the SHA keys
I am trying to make an app that can communicate with Google Cloud Messaging.
I have looked at some tutorials and read a lot of stuff, but it all skips one point. When configuring an Android Key for API Project it asks for a SHA1 certificate fingerprint.
How do I find this (I have eclipse and windows 7)?
Any help would be appreciated.
Here is how to get it :
In Eclipse, if you go to Windows ->Preferences -> Android -> Build.
You can get SHA1 from here using the steps and Keystore Password with be "android".
if you are working in android (Google drive apps, Google Map apps), and you need SHA1 or MD5 then follow this step to get your SHA1 and MD5.
Open Eclipse
Windows-->Preferences-->Android-->Build (Here you will got a path to your "debug.keystore"
Copy this path.
Find out where is your jdk (like in my system "C:\Program Files\java\jdk1.6\bin "
Now open TERMINA(cmd) and change the directory to the bin , like c:\ cd "C:\Program Files\java\jdk1.6\bin"
Now after that copy-paste this code in your terminal
keytool -list -v -keystore "C:\Users\pir fahim shah.android\debug.keystore" -alias
androiddebugkey -storepass android -keypass android
you can change your "debug.keystore" file address here.
Some snapshot which will show my process
Found debug keystore file on Mac with Android Studio at ~/.android/debug.keystore
keytool -list -v -keystore ~/.android/debug.keystore
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)
Check app run console bar
I found a very easy process to find you MD5, SHA-1 fingerprint using Android Studio.
Run your project
Go to Gradle Menu (Menu: View -> Tool Windows -> Gradle)
Go to 'signingReport' in Gradle window. (Your project -> Tasks -> android -> signingReport)
Run it. (Using double-click or Ctrl + Shift + F10)
In Run window you will find all info.
The best solution for generating SHA1 key for android is from android studio.
Click on Gradle on far right side
Click on refresh icon and you will see the name of the app
Click on the Tasks -> Report -> Signing Report
Find the SHA1 Key on bottom part in console
For Debug Version of SHA1 key open terminal and enter the following command.
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Note: If you find any error you may need to change path of your debug.keystore file(In my case it is "/.android/debug.keystore").
For Release Version of SHA1 key, first you need to generate signed apk. After that you will get .jks file. Then apply the following command in terminal.
keytool -list -v -keystore ~/.android/release.jks -alias ProjectName
Note: If you find any error you may need to change path of your release.keystore file(In my case it is "/.android/release.keystore").