Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio only gives me SHA1, I need SHA256

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?

like image 716
Immy Avatar asked Feb 17 '17 06:02

Immy


5 Answers

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.

like image 87
Manish Jain Avatar answered Oct 17 '22 06:10

Manish Jain


There is a much simpler and updated method to find it, comes from this answer.

  1. Navigate to the Gradle tab at the right side of Android Studio.
  2. In the list, navigate to the app section and expand it.
  3. In the expanded list, navigate to the Tasks section and expand it.
  4. Again, in the expanded list, navigate to the android section and expand it.
  5. 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.

like image 27
MJV Avatar answered Oct 17 '22 05:10

MJV


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

like image 23
Naga Avatar answered Oct 17 '22 06:10

Naga


You can get it from the Google Play Console (https://play.google.com/apps/publish). Follow these steps:

  1. Go to your project in GPC.
  2. Expand "Release Management".
  3. Go to "App signing".
  4. Navigate to "App signing certificate".
  5. Copy SHA-256 fingerprint.
like image 18
Tincho825 Avatar answered Oct 17 '22 04:10

Tincho825


Navigate to the Gradle tab at the right side of Android Studio

  1. Navigate to the Gradle tab on the right side of Android Studio
  2. Expand the project name
  3. Expand Tasks
  4. Expand Android
  5. Double click on signingReport
like image 7
Vikram Kodag Avatar answered Oct 17 '22 05:10

Vikram Kodag