Unable to locate an executable at "/usr/libexec/java_home/bin/keytool" (-1)

Hi I want to generate SHA1 fingerprint to use firebase in my project. I tried to use keytool to generate SHA1 fingerprint using this command

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

But it is giving me following error Unable to locate an executable at "/usr/libexec/java_home/bin/keytool" (-1)

Here I am telling you where is my jdk located and also my bash profile entries.

Jdk is not located in user/Library/Java but I opened it from here file:///Applications/Android%20Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool

Here are my bash-profile entries:

export JAVA_HOME=/usr/libexec/java_home

export JAVA7_HOME=/usr/libexec/java_home -v 1.7

Kindly guide me in detail how can i set my jdk outside AndroidStudio contents also how to edit bash-profile.

Would be highly thankful to you. Please help

1 answer

  • answered 2018-02-13 02:34 Doug Stevenson

    It's going to be easier for you to skip keytool and instead run this Gradle target to get the SHA-1 for your app:

    ./gradlew signingReport
    

    It will dump the SHA-1 of each of the variants of your app.