Generating SHA-1 For Android (The Simplest Way)

Mohamed Yehia
Jul 8, 2018 · 3 min read

In this article I’m going to explain the simplest and the easiest way to generate SHA-1 (Secure Hash Algorithm-1) for Android.
Actually I’m not going to talk about what exactly the SHA-1 is, or what does it mean.
But in some cases in Android it’s required to generate SHA-1 to use some services such as (Google Sign-in, Dynamic Links, etc…).
So, Let’s GO!

Step 1 : Generate keystore.jks File

As you do for generating signing apk. We can do that in Android Studio by clicking (Build -> Generate Signed APK…) then create new… and fill the information required such as (keystore path, keystore password, keyAlias, etc…).

Note : I recommend store the keystore.jks file in the same directory of project.
Tip : You can easily navigate to your project directory by clicking the small Android Studio logo in (choose keystore file) Dialog.

Step 2 : Add Signing Configs to your Gradle

In order to automate your APK building process you can add your signing configuration to your Hence, you can generate APK by running gradle task ( just one click ).

To do that, Click ( File ->Project Structure… ).
In the Modules section choose app and navigate to Signing tab. You should see this window.

Generating signing config

Click the green plus button. This will create an new signing configuration for you and you have to provide the missing information (That you created ealier).
Then navigate to Build Types Tab and choose release. In Signing Config dropdown choose your config.

Now to can go to your build.gradle to see your signingConfigs added like that

Gradle Signing Config

Tip : You can replace your store file full path with ($rootDir) variable to avoid conflicts of root paths if you work with other members on the same project.
Tip : You can now automate generating Signing APK from the gradle tasks.

Step 3 : Generating SHA-1

Now you can easily navigate to the Gradle tab on the right side of Android Studio and run the signingReport task.

Gradle tasks

After running this task you will find all you need in the run tab as shown :

SHA-1 (Debug/Release)

Your debug and release SHA-1 now available for you. Wow!

Thanks for reading. I Hope this would help you.
If you like what you read, Share, Clap and Friend me 😄


Happy Coding! ❤️


Our community publishes stories worth reading on Android…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store