Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/bin/sh: adb: command not found [duplicate]

When I try to run my react native app on my device, I get the following message /bin/sh: adb: command not found. The app still runs on my phone but I can't reload it or remote debug it.

There are many questions like this but their solutions don't help me.

My adb file is in ~/Library/Android/sdk/platform-tools.

I tried to do sudo nano ~/.zshrc, then under User Configuration I added export PATH="~/Library/Android/sdk/platform-tools" but it didn't help.

When I do echo $PATH I get the following (but I don't know what it means :( ): /Users/myname/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myname/.rbenv/shims:/Users/myname/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myname/.rvm/bin

I guess I should export the correct path but I don't know where to start from. Any idea?

like image 884
Tom Bomb Avatar asked Dec 13 '18 04:12

Tom Bomb


People also ask

What is the use of ADB shell in Android OS?

Android OS is based on linux os. "adb shell" command is way to enter the android device's os terminal enviroment. In this enviroment, you cannot use "adb" command. Because of "adb" is "Android Debug Bridge". bridge means that "adb" command helps to connect your working enviroment to android device's os.

Why can't I use ADB in this enviroment?

In this enviroment, you cannot use "adb" command. Because of "adb" is "Android Debug Bridge". bridge means that "adb" command helps to connect your working enviroment to android device's os. So after type "adb shell", you are in the android device's os and you cannot use "adb" command.

How do I run an ADB file on Linux?

On Linux the steps can vary, but the MacOS instructions will work in some cases. MacOS (and Linux) users will typically use zsh or bash for their shell. To temporarily add the platform-tools directory to your PATH, type: Now, whenever you type adb in this terminal window you can execute adb commands.

How do I call ADB from Android SDK?

Open or Create ".bash_profile" in your root directory of account. And insert your android sdk path to path variable in "bash_profile" file. After input path, save file and reopen your command line application. If you correct add that path, you can excute/call "adb" command in everywhere. Have fun!


1 Answers

please try:

export ANDROID_HOME=/Users/{yourusername}/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
like image 119
navylover Avatar answered Oct 19 '22 03:10

navylover