Solution of command not found adb Error

Hey Guys, Once again welcome to this post, Hope you are trying to run a react-native android app ( or doing Android development ) and facing this issue, And you find a solution on stack overflow but it worked only once and again you want to repeat the same steps.
For Example: If you try to run “adb devices” OR any other command and it says something like.

zsh: command not found adb

It tells that you are using zsh shell and /.bash_profile won’t work as it should. You will have to execute bash_profile every time with source ~/.bash_profile the command when you open the terminal, and it isn't permanent.

So this article will give you the correct solution to this issue and if you find this solution is helpful for you then please like and comment. (And If possible then go to youtube and subscribe to my channel “JavaScript Centric” https://www.youtube.com/channel/UC9MmyicGIveu0AId8OFAOmQ).

(Youtube Video: https://youtu.be/77Be98W8LVA)
So let’s start…..

About this Error: (command not found adb) if you have not installed adb on your system or if the path of adb is incorrect.

To check if adb installed or not open your terminal and run the below command:

~/Library/Android/sdk/platform-tools/adb

It will print the version of ADB and installation path but the only, adb is not in your user’s $PATH variable.

Condition 1: If it doesn't display on output then first installed adb.
Condition 2: If it is already installed then follow the below steps to set $PATH variable for permanently:

Steps:

1.Copy the installation path of adb it may be like (/Users/user-name/Library/Android/sdk/platform-tools/adb).

2.First, check if .zshrc exist or not if not create this file using the given command, Open your terminal and write

sudo touch ~/.zshrc

3.Now to open .zshrc file, write the command nano ~/.zshrc
Set the below path

export ANDROID_HOME=/Users/user-name/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH

4.To save it hit Ctrl+X, type Y to save, and then press Enter to keep the file name the same as it is

5.Restart the terminal and check with echo $PATH it will show adb path.

6.check all running adb devices by adb devices

Notes: You will not need to open /.bash_profile every time if you follow the above method.

So if you like this post hit the clap button.
And thanks for giving your useful time to read this post.
(Youtube Video: https://youtu.be/77Be98W8LVA)

14