27

I am trying to add google authentication feature in my android app and for that I need to get the Android Signing certificate SHA-1. The official tutorial says to use the below command to get the SHA-1 hash value .

In release mode

keytool -exportcert -list -v \-alias <your-key-name> -keystore <path-to-production-keystore>

debug mode

keytool -exportcert -list -v \-alias androiddebugkey -keystore ~/.android/debug.keystore

Now I am confused with what is this production-keystore and debug.keystore and how to get the path to production-keystore? Explanations are appreciated.

A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
Hari Krishnan
  • 5,992
  • 9
  • 37
  • 55

2 Answers2

19

Please use below command for linux, if you don't have keystore file:

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

Production keystore will generate when you are creating signed APK file.

Refer below link for information:

http://developer.android.com/tools/publishing/app-signing.html

Saritha G
  • 2,588
  • 1
  • 15
  • 27
  • 1
    actually i want to know what is keystore file and its purpose. i wanna know that should i create a keystore for my app manually or will it be there by default?.. like that – Hari Krishnan Apr 29 '16 at 11:54
  • you have to create keystore file by generating signed apk. – Saritha G Apr 29 '16 at 11:56
  • build->generate signed apk asks for key store path. what should i give there ? – Hari Krishnan Apr 29 '16 at 11:57
  • In android studio, there is a Build option-->selected generate Signed APK -->you will get a dialog then enter the details to generate signed apk file, in dat dialog u also have option called keystore path, mention the path of the keystore. – Saritha G Apr 29 '16 at 11:58
  • you have to give any path like empty folder path, it may be inside of your app folder or on Desktop. There the keystore file will be saved. – Saritha G Apr 29 '16 at 11:59
  • I cant select a folder as path there. The ok button is blurred – Hari Krishnan Apr 29 '16 at 12:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/110645/discussion-between-hari-krishnan-and-saritha-g). – Hari Krishnan Apr 29 '16 at 12:45
  • create new button is there na. – Saritha G Apr 29 '16 at 12:45
  • have you seen that screenshot that i shared. plz see that on chat – Hari Krishnan Apr 29 '16 at 12:51
  • I want to work on google sign up . so should i use debug keystore or production ? – Anuj Oct 11 '17 at 19:14
  • @Anuj Use debug keystore. – Saritha G Oct 16 '17 at 11:45
  • @Anuj I know this is an old topic, but I recently had a similar conversation with another developer. The production keystore can be misleading because the name still says, "debug.keystore". The way you know you have generated the proper keystore is by uploading your APK to google play console. Google will reject the upload, and inform you that your APK is not signed with a production keystore. Btw, just as another tip. Store this keystore someplace safe. If you lose it, you effectively lose the ability to update your app ever again. – portfoliobuilder Sep 24 '18 at 21:45
2

Stumble upon this but I was using Windows. I got my answer hoping to help other Windows user who came to this post.

keytool -list -v -alias androiddebugkey -keystore C:\Users\<name>\.android\debug.keystore
Michimcchicken
  • 543
  • 1
  • 6
  • 21
  • Just for detailed explanation, look at this page https://developers.google.com/android/guides/client-auth – GuruJeya Feb 13 '21 at 06:20