I need to run an adb forward
command before I could use the ezkeyboard application which allows user to type on the phone using browser.
When
+ The reason is: you are in the wrong directory (means it doesn't contain adb executor).
+ The solution is (step by step):
1) Find where the adb was installed. Depend on what OS you are using.
Mac, it could be in: "~/Library/Android/sdk/platform-tools
"
or
Window, it could be in: "%USERPROFILE%\AppData\Local\Android\sdk\platform-tools\
".
However, in case you could NOT remember this such long directory, you can quickly find it by the command "find
". Try this in your terminal/ command line, "find / -name "platform-tools" 2> /dev/null
" (Note: I didn't test in Window yet, but it works with Mac for sure).
*Explain the find command,
2> /dev/null
" --> ignore find results denied by permission. Try the one without this code, you will understand what I mean.2) Go to where we installed adb. There are 3 ways mentioned by many people:
Change the PATH global param (which I won't recommend) by: "export PATH=~/Library/Android/sdk/platform-tools
" which is the directory you got from above. Note, this command won't print any result, if you want to make sure you changed PATH successfully, call "export | grep PATH
" to see what the PATH is.
Add more definition for the PATH global param (which I recommend) by: "export PATH=~/Library/Android/sdk/platform-tools:$PATH
" or "export PATH=$PATH:~/Library/Android/sdk/platform-tools
"
Go to the path we found above by "cd ~/Library/Android/sdk/platform-tools
"
3) Use adb:
If you change or update the PATH, simply call any adb functions, since you added the PATH as a global param. (e.g: "adb devices
")
If you go to the PATH by cd
command, call adb functions with pre-fix "./
" (e.g: "./ adb devices
")
Type the below command in terminal:
nano .bash_profile
And add the following lines (replace USERNAME with your own user name).
export ANDROID_HOME=/Users/USERNAME/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
Close the text editor, and then enter the command below:
source .bash_profile
nano /home/user/.bashrc
export ANDROID_HOME=/psth/to/android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
However, this will not work for su/ sudo. If you need to set system-wide variables, you may want to think about adding them to /etc/profile, /etc/bash.bashrc, or /etc/environment.
ie:
nano /etc/bash.bashrc
export ANDROID_HOME=/psth/to/android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
To avoid rewriting the $PATH variables every time you start a terminal, edit your .bash_profile (for Macs, it's just .profile) file under your home directory (~/), and place the export statement somewhere in the file.
Now every time you start terminal, your $PATH variable will be correctly updated. To update the terminal environment immediately after modifying the profile file, type in:
source ~/.profile
From the file android-sdks/tools/adb_has_moved.txt:
The adb tool has moved to platform-tools/
If you don't see this directory in your SDK, launch the SDK and AVD Manager (execute the android tool) and install "Android SDK Platform-tools"
Please also update your PATH environment variable to include the platform-tools/ directory, so you can execute adb from any location.
so on UNIX do something like:
export PATH=$PATH:~/android-sdks/platform-tools
I solved this issue by install adb package. I'm using Ubuntu.
sudo apt install adb
I think this will help to you.