I am trying to implement Firebase in my Android Studio app and since I want to use Firebase Auth I need the SHA-1 Signing Certificate, and to get it I need to run this code in the CMD:
keytool -exportcert -list -v \
-alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
But I get:
"keytool" is not recognized as an internal or external command program or executable batch file
And that I already tried to cd into the folder .android
and JAVA is already in the path and I already added the JAVA_HOME variable .
What I do?
the problem you mention
It is because where you are trying to execute
keytool
does not really exist, if the directory is not defined in the environment variables in windows you simply will not be able to access it from any folder, make sure the path is correctly defined (When you define an environment variable in the versions current Windows it seems to me that a restart of your pc is not necessary, but it could be an option).If you ensure that the path defined is correct in the variable
%JAVA_HOME%
, make the change to your directory on the command line like thisremember that
keytool
it is in the directory\bin
of your JAVA installation (for example in my case it isC:\Program Files\Java\jdk1.8.0_102\bin
), laterperform the operation you want
In my case -using windows 10 and PowerShell- I had to add " ./ " to the beginning of the command, like this:
To get the SHA-1, it worked for me with
I saw it in the documentation
I was getting the error because I was executing the command in the wrong directory. Once I opened the CMD as administrator and I went to the path where I had installed the version of my JAVA and entered the bin folder, there I executed the command again and I mentioned.