Search code examples
androidandroid-studiocertificatesha1fingerprint

Cannot get SHA1 certificate fingerprint Android Studio


I'm very new in Android, i'm building an app what will uses the googleMaps API, before i can use it, i need SHA1 certificate fingerprint, i follow many tutorials to get SHA1 certificate fingerprint and this displayed on my commandPrompt: (sorry i'm not allowed to post an image here) :

Lists entries in a keystore

options:
-rfc                      output in RFC style
-alias <alias>            alias name of the entry to process
-keystore <keystore>      keystore name
-storepass <arg>          keystore password
and e.t.c...

after i go into bin folder inside java\jdk 7\

and ran this command: eytool -list -v -keystore C:\Users\leon.android\debug.keystore -alias androiddebugkey -storepass android -keypass android


Solution

  • The easiest way to do this (for debugging) is to run the app in debug connected to Android Studio. Check the messages (logcat) in Android studio and you'll see a message, in red "Unable to connect Google Maps: Authorisation Failure" and then underneath that will be the exact string you need to copy into the Google API Console (SHA1 + app name). Copy, paste, wait a bit for Google to spread to all the servers and then try again.

    Otherwise, you just need to run

    keytool -list -v -keystore mystore.keystore
    

    (No need for the other parameters) and it's the entry under SHA1 that you need.