adb command not found

437,040

Solution 1

Make sure adb is in your user's $PATH variable.

or

You can try to locate it with whereis and run it with ./adb

Solution 2

In my case with Android Studio 1.1.0 path was this

/Users/<username>/Library/Android/sdk/platform-tools

Add the following to ~/.bash_profile

export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH

Solution 3

Is adb installed? To check, run the following command in Terminal:

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

If that prints output, skip these following install steps and go straight to the final Terminal command I list:

  1. Launch Android Studio
  2. Launch SDK Manager via Tools -> Android -> SDK Manager
  3. Check Android SDK Platform-Tools

Run the following command on your Mac and restart your Terminal session:

echo export "PATH=~/Library/Android/sdk/platform-tools:$PATH" >> ~/.bash_profile

Note: If you've switched to zsh, the above command should use .zshenv rather than .bash_profile

Solution 4

I am using Mac 10.11.1 and using android studio 1.5, I have my adb "/Users/user-name/Library/Android/sdk/platform-tools"

Now edit you bash_profile

emacs ~/.bash_profile

Add this line to your bash_profile, and replace the user-name with your username

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

save and close. Run this command to reload your bash_profile

source ~/.bash_profile

Solution 5

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

Share:
437,040

Related videos on Youtube

coure2011
Author by

coure2011

Updated on July 19, 2022

Comments

  • coure2011
    coure2011 almost 2 years

    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 I run adb forward tcp:8080 tcp:8080 command I get the adb command not found error message.

    I can run android command from terminal. Why adb is not working?

  • Chris Stratton
    Chris Stratton about 12 years
    ./adb would only work if the current directory (which is what . is shorthand for) is the location of the adb program. Otherwise it would be /some/path/found/by/wheris/adb
  • kevoroid
    kevoroid about 12 years
    Yes I know :-) that's what I meant with finding it and running it from there
  • Aadishri
    Aadishri over 10 years
    export to $Path in your ~/bashrc
  • Serty Oan
    Serty Oan over 9 years
    Selected answer should be edited/completed with this, because adb moved for a long time and the adb_has_moved.txt is not there anymore
  • Pnar Sbi Wer
    Pnar Sbi Wer about 6 years
    could try ~/Library/Android/sdk/platform-tools/adb
  • yuzuriha
    yuzuriha almost 6 years
    export PATH="~/Library/Android/sdk/platform-tools":$PATH should do it, no need to change anything
  • Jk Jensen
    Jk Jensen over 5 years
    More recently this is ~/Library/android/sdk/platform-tools/ on macOS.
  • Linh
    Linh over 5 years
    I also need to run source ~/.bash_profile to make it work
  • n3wbie
    n3wbie over 4 years
    @Gowtham Sooryaraj those paths are where the tools are located. Adding them to the PATH variable of your env allows you to access the tools (adb here) whithout the need to give the full path of its location (~/Library/Android/sdk/platform-tools/adb). When you type adb in your terminal, its seeks a similar tool in all the paths of the env PATH variable. I hope it helps :)
  • Mike Collins
    Mike Collins about 4 years
    You shouldn’t need to be in the platform-tools directory. That means your PATH isn’t set correctly and you’d be better off following one of the other answers here.
  • Mike Collins
    Mike Collins about 4 years
    You should add the appropriate export statement to this answer.
  • mokagio
    mokagio about 4 years
    This did it for me too. I bumped into it while using Fastlane's screengrab. Thanks!
  • Andrey Aleev
    Andrey Aleev almost 4 years
    Thank you very much! For zsh your answer with .zshenv worked for me while other answer suggesting .zshrc didn't.
  • Tyler Pfaff
    Tyler Pfaff over 3 years
    I have to run source ~/.bash_profile all the time, what does it do?
  • Mike Collins
    Mike Collins over 3 years
    @TylerPfaff it reloads your shell profile. Closing your terminal and reopening it has the same effect.
  • kca
    kca over 3 years
    could try ~/Android/Sdk/platform-tools/adb (in Ubuntu 20.04)
  • Masoud Darzi
    Masoud Darzi over 3 years
    the answer is correct but just if the shell is zsh you have to change .bash_profile to .zshenv
  • sina farbod
    sina farbod about 3 years
    brew install --cask android-platform-tools in 2021
  • Jay Smoke
    Jay Smoke over 2 years
    Four years later and this is still very much helpful. Thank You
  • luis.ap.uyen
    luis.ap.uyen over 2 years
    The last command is what allowed me to run adb from anywhere in the console. That final tweak was missing in other answers
  • Rik
    Rik over 2 years
    On Debian, using Arctic Fox, its: ~/Android/Sdk/platform-tools/adb <remaining-command-parts> to run an adb command with out it added to path (that's its latest location). So you'll want to export PATH=~/Android/Sdk/platform-tools:$PATH. Definitely run a source ~/.bash_profile or source ~/.bashrc, depending on where you put it, if you don't want to restart your terminal.
  • german1311
    german1311 over 2 years
    Append values to .zprofile file for those who use zsh
  • user1034912
    user1034912 about 2 years
    does this set the path as well?
  • room_n
    room_n almost 2 years
    This is the working solution for me. Thanks!