Before we proceed further in how to generate the Android studio SHA key let’s know what is SHA key is,
Updated post can be found in this link How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
SHA stands for Secure Hash Algorithm, it is a cryptography hash function which takes an input and produces a 160 – a bit hash value known as a message digest. It is typically rendered as a hexadecimal number having 40 digits. It was designed by US National security.
Versions of SHA
There are two versions of the SHA key available.
- SHA-1 – 160 bit (5 x 32)
- SHA-2 – 256 bit (8×32)
SHA key is a unique key generated for your PC and used for signing. It is mostly used for accessing the Google API in the case of Android application development.
Also Read: Share data across activities in Android
How to get your SHA key
There are a few following ways to generate the Android studio SHA key for Android development, by using any one of the ways you can generate your SHA key.
Using the Terminal/Command prompt
Open your computer terminal or command prompt and change the directory to the bin folder of Java SDK. In Windows, you can find the folder in C:/Program Files/Java/jdk<version_number>/bin
Now type the following in the command prompt to get your SHA key, to use this method the PC should have JDK installed on it.
for example,
if you’re not sure what is your username follow the below to proceed.
after this, you will get your key as below
Using Android Studio
This is the simplest way to generate the SHA key for your Android studio project. One can easily generate and get the SHA key using the following methods.
Open Android studio and your project, now navigate to the Gradle bar located in the right-side panel. Click on the refresh from the Gradle bar and you will see the list of Gradle files.
Now click on your project – your project name from the list, and click on tasks. Then click on Android to proceed further. Double click on the signingReport and it will run and display your SHA keys in the Run bar (sometimes in the Gradle console)
Comments 1