ERROR:'keytool' is not recognized as an internal or external command, operable program or batch file

AndroidKeytool

Android Problem Overview


When I use the command:

C:\>keytool -list -alias androiddebugkey 
            -keystore .android\debug.keystore 
            -storepass android -keypass android

I get this error:

> 'keytool' is not recognized as an internal or external command, operable program or batch file.

I'm not able to get the certificate fingerprint(MD5) on my computer.

I have ensured that the keystore file is present in the appropriate location.

Any help?

Android Solutions


Solution 1 - Android

Check that the directory the keytool executable is in is on your %PATH% environment variable.

For example, on my Windows 7 machine, it is in C:\Program Files (x86)\Java\jre6\bin, and my %PATH% variable looks like C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Java\jre6\bin;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ (and many other entries)

Solution 2 - Android

This worked for me !! :

Go to this path or where ever you have your keytool.exe file

C:\Program Files\Java\jre7\bin

Hold shift and right click -> then press Open command window here

terminal will pop up, paste this in:

keytool -list -v -keystore "C:\Users\"Your-User-Name(no quotes)"\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

gives you both MD5 and SHA1

Solution 3 - Android

Found it.

GO TO:

my computer->rightClick->properties->Advanced system settings->environment variables->find path in system variables->dbl click-> paste the "C:\Program Files\Java\jdk1.6.0_16\bin"->OK

GO TO:

cmd -> keytool -list -alias androiddebugkey -keystore "C:\Users\meee\.android\debug.keystore" -storepass android -keypass android

Solution 4 - Android

  1. Go to My computer -> right click -> system properties -> environmental variables -> Path -> add you jdk/bin to this path

     C:\Program Files\Java\jdk1.8.0_211\bin
    

*if this not work then

  1. In cmd set the path by using the below command

     set PATH=C:\Program Files\Java\jdk1.8.0_211\bin
    

now the path is set now you can use the keytool

Solution 5 - Android

So if you have the following structure now:

 C:\Program Files\Java\jre6\bin\
                                keytool.exe
                                debug.keystore

then execute:

C:\Program Files\Java\jre6\bin>keytool -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android 

Solution 6 - Android

keytool ships with Android Studio as part of the JRE needed to run Android Studio.

On Windows its: C:\Program Files\Android\Android Studio\jre\bin\keytool.exe

On Mac its: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool

Add it to your environment variables then run the keytool command again.

Solution 7 - Android

On windows 8, go to C:\Program Files\Java\jre7\bin and in the address bar, type "cmd" without the quotes. This will launch the terminal. Then type in string as describe here.

Solution 8 - Android

if you want to run keytool from any location of terminal

example: C:>keytool

you need to add the system variables

for Windows:

1) create:
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_45

2) add to Path
%JAVA_HOME%\bin;

Solution 9 - Android

all you can do is to navigate to your jre destination in your computer via command line and then once you reach bin, you type the keytool command and it would work.

C:\Program Files (x86)\Java\jre7\bin>
C:\Program Files (x86)\Java\jre7\bin>keytool -list -v -keystore"%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android



Alias name: androiddebugkey
Creation date: 23 Feb, 2014
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 479d4fe7
Valid from: Sun Feb 23 06:19:02 IST 2014 until: Tue Feb 16 06:19:02 IST 2044
Certificate fingerprints:
MD5:  DB:6A:8E:48:22:5B:37:73:B1:91:EF:43:3F:26:F0:EC
SHA1: B4:6B:2E:5F:5A:30:C5:E4:E7:12:BB:F0:74:FC:2B:43:64:3A:FC:15
SHA256: CB:59:F3:20:7D:5B:87:99:6C:0D:32:79:79:CF:4E:8C:16:C2:37:81:7B:
B0:AF:D2:EC:3C:11:21:53:58:62:F6
Signature algorithm name: SHA256withRSA
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: FA 96 17 9E 94 73 C3 42   F0 4B 55 5B C7 5B EE BB  .....s.B.KU[.[..
0010: C3 E5 D3 61                                        ...a
]
]

Solution 10 - Android

Make sure JAVA_HOME is set and the path in environment variables reflects the bin directory of JAVA_HOME. Basically, the PATH should be able to find the keytools.exe file in your jdk location.

Solution 11 - Android

Easy, just find the location where keytool executable is, normally is in java/jre(Version)/bin forexample in my computer is in C:\Program Files\Java\jre7\bin. all you have to do is go to environment variables, click PATH to make it active, then click edit, then add complete path where your keytool is, for me i will add C:\Program Files\Java\jre7\bin this will allow you to execute keytool commands without going to the directory where keytool is installed.

Solution 12 - Android

This is due to path for keytool.exe not set.

Open command prompt in your windows machine, go to where you would like to run keytool cmd and then set path where keytool.exe present

Step 1 : Open cmd promt and run

cd C:\Program Files\Java\jdk1.8.0_131\jre\lib\security

Step 2 : Run below cmd to set path using

set PATH=C:\Program Files\Java\jdk1.8.0_131\bin

Step 3 : Run keytool cmd, now it will be able to recognize

keytool -list -alias <rest of the arguments>

Solution 13 - Android

This means, that your shell couldn't find the tool on your harddisk.

A)

  • Change the working directory to C:\Program Files\Java\jre6\bin\
  • Execute keytool -list -alias androiddebugkey keystore <full directory name make sure that you use enclosing in quotes> -storepass android -keypass android

B)

  • Add C:\Program Files\Java\jre6\bin\ to your PATH variable

Solution 14 - Android

I suffered alot trying to find a solution to it and finally I found the solution by first setting the jre path to system variables by navigating to::

control panel > System and Security > System > Advanced system settings 

Under System variables click on new

Variable name: KEY_PATH
Variable value: C:\Program Files (x86)\Java\jre1.8.0_171\bin

Where Variable value should be the path to your JDK's bin folder.

Then open command prompt and Change directory to the same JDK's bin folder like this

C:\Program Files (x86)\Java\jre1.8.0_171\bin 

then copy and paste the code below in cmd

keytool -list -v -keystore "C:\Users\user\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android   

Solution 15 - Android

In my case problem was in using PowerShell instead of CMD :)

Solution 16 - Android

i am using gui tool ,Must try Who don't want to use keystore command line

it is GUI tool for create keystore.jks and export pem file and lot

https://keystore-explorer.org/downloads.html

Solution 17 - Android

Give:

keytool -list -keystore ~/.android/debug.keystore

Also in your line there is a space in keystore. Please check it.

Solution 18 - Android

I know there are already several answers but none of them worked for me, so i am posting one that worked for me, may be helpful for someone.

First of all directory to keytool.exe must be on path

and if instead of directory being on path it is giving error then Try starting command line as a normal user instead of as a administrator or changing the directory to home directory

Solution 19 - Android

Open "Environment Variables" (you can get to it from your start menu search in Win10) double check the path that the jdk is in, to make sure it exists. For me, it said "...jdk1.8/bin" But when I copied that into Windows Explorer or command prompt, it said that it didn't exist. I checked where it should have been, and it said "jdk1.8.0_77"

A simple rename of the setting in Android Studio and keytool was working!

Solution 20 - Android

A simple solution of error is that you first need to change the folder directory in command prompt. By default in command prompt or in terminal(Inside Android studio in the bottom)tab the path is set to C:\Users#Name of your PC that you selected\AndroidStudioProjects#app name\flutter_app> Change accordingly:- C:\Users#Name of your PC that you selected\AndroidStudioProjects#app name\flutter_app>cd\

type *cd* (#after flutter_app>), type only cd\ not comma's

#then type cd Program Files\Java\jre1.8.0_251\bin (#remember to check the file name of jre properly) #now type keytool -list -v -keystore "%USERPROFILE%.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android (without anyspace type the command).

screenshot of the codes to run

Solution 21 - Android

  1. Go to C:->Program Files->Java->jdk->bin. Here,keytool.exe file resides. 2.Copy the path till bin. 3.Go to: Control Panel\System and Security\System 4.Click Advanced System Setting 5.Click Environment Variables 6.Under System Variables(bottom half): Double click on Variable: Path B. Add the path: (Click New then add) C:\Program Files\Java\jdk1.8.0_191\bin (your path) 8.VERIFY: Open command prompt & enter "Keytool" It should show keytool details & no error mssg.

Solution 22 - Android

add C:\Program Files\Java\jdk-15.0.1\bin this into Environment Variables. refer to this website.

Solution 23 - Android

That simply means the keytool keyword is not installed in your system visit : visit here and download java JDK first.

Then set the java JDK in your environmental variable.

Solution 24 - Android

The Works for fine

Go to Path

C:\Program Files\Java\jre7\bin> keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Developer\.android\debug.keystore"

Then enter Ketsore Password and job done!!

Solution 25 - Android

Open Command prompt type this..

"c:\Program Files(x86)\Java\jdk1.7.0\bin\keytool.exe" -list -v -alias androiddebugkey -keystore "C:\Users\EIS.android\debug.keystore" -storepass android -keypass android

Then Hit Enter MD5 and SHA1 key will get

Solution 26 - Android

For windows 10 you need to path C:\Program Files\Java\jre1.8.0_161\bin

restart command and open

Solution 27 - Android

Locate where your keytool.exe inside java installation folder

mine is C:\Program Files\Java\jre1.8.0_181\bin open cmd anywhere and run

SET PATH=%PATH%;C:\Program Files\Java\jre1.8.0_181\bin;

change the path to the path you located your keytool.exe

Solution 28 - Android

My case is, it doesn't work wherever I call it, no matter I path the file or not, if I open it with powershell.

but it works if I open it with cmd.

Solution 29 - Android

Just search on the following path : C:\ → Program Files → Java → jre1.xxx → bin
be sure this bin folder includes this keytool.exe

Then open the command prompt.

then type : (cd means change directory) cd C:\Program Files\Java\jre1.8.0_231\bin

Then type the command, and press enter

Solution 30 - Android

The keytool command might not be in your path—it’s part of Java, which is installed as part of Android Studio. For the concrete path, run flutter doctor -v and locate the path printed after ‘Java binary at:’. Then use that fully qualified path replacing java (at the end) with keytool. If your path includes space-separated names, such as Program Files, use platform-appropriate notation for the names. For example, on Mac/Linux use Program\ Files, and on Windows use "Program Files".

Solution 31 - Android

open Advanced system settings --> open environment variable --> in system variable double click on "Path" --> copy your jdk path from C , should be like this "C:\Program Files\Java\jdk-15.0.2\bin" and paste it after click on New --> click ok then restart android studio , this should fix the problem

Solution 32 - Android

If you use flutter and have downloaded openssl-for-windows:

  • Open Command Prompt
  • Type flutter doctor -v
  • Under Android toolchain you will see Java binary at: C:\Program Files\Android\jre\bin\java
  • Now copy the line of code and do cd C:\Program Files\Android\jre\bin
  • Type keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Username\.android\debug.keystore" | "Location to openssl.exe" sha1 -binary | "Location to openssl.exe" base64

(Double quotes are necessary)

  • Enter keystore password: android (default password)

This will give you Key Hash.

Solution 33 - Android

  1. Open where your KEYTOOL.EXE in yourJAVA file such as e.g C:\Program Files\Java\bin\keytool.exe.

  2. HOLD SHIFT and Right Click on the BIN Folder where your keytool.exe is located and click open CMD or RUN Command from here.

  3. This opens cmd. then type in

keytool -exportcert -alias NAME OF YOUR KEYSTORE -keystore PATH OF KEYSTORE.jks" | "C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64

  1. Password Prompt, enter android and BOOOOOOOM...You have your Key.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionShaliniView Question on Stackoverflow
Solution 1 - AndroidBen WilliamsView Answer on Stackoverflow
Solution 2 - AndroidJakobView Answer on Stackoverflow
Solution 3 - AndroidAmt87View Answer on Stackoverflow
Solution 4 - AndroidMANOJ GView Answer on Stackoverflow
Solution 5 - AndroidZhekoView Answer on Stackoverflow
Solution 6 - AndroidTim TrustonView Answer on Stackoverflow
Solution 7 - AndroidNeutrinoView Answer on Stackoverflow
Solution 8 - AndroidProbojnikView Answer on Stackoverflow
Solution 9 - AndroidkrrishView Answer on Stackoverflow
Solution 10 - AndroidSharan RajendranView Answer on Stackoverflow
Solution 11 - AndroidJohnPepView Answer on Stackoverflow
Solution 12 - AndroidVishwas Shenoy AlevoorView Answer on Stackoverflow
Solution 13 - AndroidjjjView Answer on Stackoverflow
Solution 14 - AndroidJude OkoroaforView Answer on Stackoverflow
Solution 15 - AndroidSkylin RView Answer on Stackoverflow
Solution 16 - AndroidßãlãjîView Answer on Stackoverflow
Solution 17 - AndroidAnjuView Answer on Stackoverflow
Solution 18 - AndroidHenuView Answer on Stackoverflow
Solution 19 - AndroidsonictimmView Answer on Stackoverflow
Solution 20 - AndroidSourabh BiswasView Answer on Stackoverflow
Solution 21 - AndroidRohit MondalView Answer on Stackoverflow
Solution 22 - AndroidAkash_18View Answer on Stackoverflow
Solution 23 - AndroidcodeloneView Answer on Stackoverflow
Solution 24 - Androiduser1576593View Answer on Stackoverflow
Solution 25 - AndroidsssView Answer on Stackoverflow
Solution 26 - AndroidMd Rashedul IslamView Answer on Stackoverflow
Solution 27 - AndroidAhmed AdewaleView Answer on Stackoverflow
Solution 28 - AndroidWesleywaiView Answer on Stackoverflow
Solution 29 - AndroidAlex SommeraView Answer on Stackoverflow
Solution 30 - AndroidMahmoud HamdyView Answer on Stackoverflow
Solution 31 - AndroidMohamed MansourView Answer on Stackoverflow
Solution 32 - AndroidCynthia KonarView Answer on Stackoverflow
Solution 33 - AndroidSUPAVIVA -The Orion TVView Answer on Stackoverflow