Last Updated on 2021-10-25 by Clay
When we want to launch the developed application to the Google Play store, we often need to use keytool that provided by Java, to generate, import, and export certificates. By default, keytool will create a keystore file in its execution directory. (but you can change the output location)
Today when I tried to use the keytool provided by Android Studio for the first time, the following error message appeared:
bash: keytool: command not found
The reason is obvious: the terminal does not know the location of the keytool; but in fact, even I didn't know the location at first.
Solution
We can use the find
command to search the location of keytool.
sudo find / -name "keytool"
After we find the path, assume it is /home/clay/Tools/android-studio/jre/bin/
, we can export the path to environment variables.
echo 'export "PATH=$PATH:/home/clay/Tools/android-studio/jre/bin/"' >> ~/.bashrc
source ~/.bashrc
Then you should be able to use the keytool normally.
Pingback: Keytool Command Not Found? Best 30 Answer - Ar.taphoamini.com