Sha1 Key for Debug & Release Android Studio MAC , How to Generate Sha1 Release Keys in MAC

SHA1 Key for DEBUG & RELEASE ANDROID STUDIO MAC , How to generate SHA1 Release Keys in Mac?

DEBUG:

  1. Click on the Gradle tab on the right hand side of the view.

  2. Go to the ROOT folder -> Tasks -> android -> signingReport

  3. Double click, this will build with the signingReport and post in your bottom view your SHA1.

RELEASE:

  1. In android studio. Build -> Generate Signed APK... and click Next

  2. Copy your key store path and key alias.

Sample Image


  1. Traverse to the "bin" folder of the jdk path present in Java.

  2. Open terminal and enter:

    keytool -list -v -keystore "key store path" -alias "key alias"

  3. Enter your key password and this will print out your release SHA1.

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 generate a different debug sha1-key

Step 1) Go to File > Project Structure > select project > go to
"signing" and select your default or any keystore you want and fill
all the details. In case you are not able to fill the details, hit the
green '+' button.

Step 2) VERY IMPORTANT: Goto Build Types> select your build type and
select your "Signing Config".

https://stackoverflow.com/a/17992232/4853835

Another solution: you can move (move to a backup folder) keys from this directory then build your project (Android studio will create new key):

  • For Windows User: C:\Users\USERNAME.android\debug.keystore (Change USERNAME as your pc name)
  • For Linux or Mac OS User: ~/.android/debug.keystore

Get SHA1 fingerprint certificate in Android Studio for Google Maps

I got my Answer, it was quit simple.
Open Terminal,
Type command:

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

Press Enter: You will get the following info, and SHA1 can be seen there.

.....

Certificate fingerprints:

 MD5:  79:F5:59:................FE:09:D1:EC

SHA1: 33:57:0A:C9:..................:91:47:14:CD

SHA256: 39:AA:23:88:D6:...................33:DF:61:24:CB:17:47:EA:39:94:99

.......

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:

  1. Open Android Studio
  2. Open your Project
  3. Click on Gradle (From Right Side Panel, you will see Gradle Bar)
  4. Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)
  5. Click on Your Project (Your Project Name form List (root))
  6. Click on Tasks
  7. Click on Android
  8. Double Click on signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console))
  9. Select app module from module selection dropdown to run or debug your application

Check the screenshot below:

Sample Image

2. Work with Google Maps Activity:

  1. Open Android Studio
  2. Open Your Project
  3. Click on File menu -> Select New -> Click on Google -> Select Google Maps Activity
  4. A dialog would appear -> Click on Finish
  5. Android Studio would automatically generate an XML file named with google_maps_api.xml
  6. You would get debug SHA1 key here (at line number 10 of the XML file)

Check Screenshot below:

Sample Image

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:

Sample Image

Done.

How to generate SHA1, SHA256, MD5 for default debug key using keytool in Mac, Windows and Linux?

Following will give you SHA1, SHA256, MD5 for default debug key.
And it can be used for developing and debugging with google play services.

Linux & Mac command

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

Windows

keytool -exportcert -keystore C:\Users\<USERNAME>\.android\debug.keystore -list -v

Replace with your windows account name example:

keytool -exportcert -keystore C:\Users\Aakash\.android\debug.keystore -list -v

If asked password, type: android

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

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.

  1. Select android/app/build.gradle file and on the right top corner click "Open for Editing in Android Studio"

Sample Image


  1. Open Gradle panel and double click on "SigninReport",

see Android studio Gradle Tab

Sample Image


  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.

Sample Image

How to Get SHA-1 key in React Native cli?

  1. Windows:

    – Open a terminal window

    – Change the directory to the JDK bin directory. The path of the JDK depends upon the operating system you are using

    cd C:\Program Files\Java\jdk1.8.0_121\bin

    – Now we have to run the following command using the keytool.exe file in JDK/bin

    keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

    Sample Image

  2. Ubuntu/Mac

    – Open a terminal window

    – Now run the following command

    keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

    Sample Image

For more details click Here


  1. From React-native Project:

    – Run this command in React-Native App directory

    cd android && ./gradlew signingReport

    – copy the SHA1 from the debug key (This generates two variant keys. You can copy the 'SHA1' that belongs to the debugAndroidTest variant key option.)

Generate release SHA1 certificate using Android studio

Select your buildVariant to release types. Then go to Project structure -> Default config -> SigninConfig -> and then select your release signinConfig for Release SHA1 and debug signinConfig for Debug SHA1.

Sample Image



Related Topics



Leave a reply



Submit