AceInventor
AceInventor

Reputation: 159

How to restart android adb using terminal on macOS?

I keep having an issue with the Android Studio ADB not recognizing my devices. So far, the only solution I've found is to do a complete reboot of my entire computer, which isn't practical. I'd like to be able to restart the ADB from terminal, because I have seen other posts on here that claim it will fix the issue. However, I can't figure out where to use the commands "adb kill-server", because doing it at the base directory returns a "command not recognized". Can somebody help me figure out how to navigate into Android from terminal and use the command? Or, does anybody have another solution to the original problem of Android Studio not recognizing my devices?

Thanks in advance! Sorry for the wordiness.

Upvotes: 16

Views: 38306

Answers (4)

Imron Gamidli
Imron Gamidli

Reputation: 101

if adb kill-server not responding. Find the process id (PID) by typing top in terminal and finding PID next to adb. Then type kill <PID>

For example, for me PID for adb was 70163. Then i typed kill 70163

Upvotes: 2

Farab Alipanah
Farab Alipanah

Reputation: 401

Simply stop adb:

adb kill-server

Then you can start it again any time:

adb start-server

Upvotes: 1

Blackbelt
Blackbelt

Reputation: 157467

blackbelt:~ blackbelt$ adb kill-server
blackbelt:~ blackbelt$ adb start-server

works on Linux as well as on Mac. In my machine, adb is in PATH

"command not recognized". Can somebody help me figure out how to navigate into Android from terminal and use the command? Or, does anybody have another solution to the original problem of Android Studio not recognizing my devices?

In your case adb is not declared in PATH. You can either export the PATH, or specify the full qualified path to adb in the command line. E.g.

 blackbelt:~ blackbelt$ /path/to/platform-tools/adb kill-server
 blackbelt:~ blackbelt$ /path/to/platform-tools/adb start-server

or

 blackbelt:~ blackbelt$ ./adb kill-server
 blackbelt:~ blackbelt$ ./adb start-server 

if you are inside platform-tools

Upvotes: 25

Ankush Sharma
Ankush Sharma

Reputation: 933

Well instead of doing it through command line, if you find that hard you can also do the same from android studio. Go to tools -> Android -> Android device monitor . Then it will open the separate window where you can see all the devices or emulator attached to the process. On the left hand side below the Devices tab there will be and menu bar, you need to click on the drop down arrow which will give you the option to reset the adb. Here is the image for reference enter image description here

If you are using windows try to update the device driver for your device make sure the adb is correctly installed. When you connect your device to system see if it is allowed to be used at the system.

Upvotes: 4

Related Questions