Search code examples
androidgoogle-apikeystoresha

Error Generating Certificate SHA-1


I'm trying to integrate my app with the Google API. For this you need to provide the sha-1 of the signing certificate.

At the command prompt, I use the following command provided by Google:

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

With this, I get the following error:

erro de keytool: java.lang.Exception: O arquivo da área de armazenamento de chaves não existe. %shang%\.android\debug.keystore
java.lang.Exception: O arquivo da área de armazenamento de chaves não existe. %shang%\.android\debug.keystore
        at sun.security.tools.keytool.Main.doCommands(Main.java:745)
        at sun.security.tools.keytool.Main.run(Main.java:343)
        at sun.security.tools.keytool.Main.main(Main.java:336)

However, the debug.keystore file exists.

enter image description here


Solution

  • For SHA1 Debug Key , run below command in android studio terminal.

    Mac/Linux :

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

    Windows :

     keytool -exportcert -list -v \
    -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
    

    Replace the %USERPROFILE% with your user path .

    The Password is default : android