Android adb hangs in list devices and other commands
Asked Answered
F

6

9

When I try to run adb commands from terminal, especially adb devices, adb kill-server and adb start-server it hangs and I need to type CTRL+C to exit proccess. Its not possible to deploy APK to physical or virtual devices. Something is block adb proccess/port. I have anti-virus uninstalled and firewall disabled.

In the example below, I type adb devices and terminal show me List of devices attached and hangs in there.

enter image description here

Foreconscious answered 4/8, 2016 at 11:43 Comment(2)
can you please share the image of the device manager, when the device is connected to the PC via USB?Gravesend
Device Manager: imgur.com/Exk5E4qForeconscious
N
19

adb binds to TCP port 5037, if this port is in use by different process you might see that any adb commands would just hang and wont do anything.

  • Use "netstat -aon | more" commands to figure out which process is on port 5037
  • kill the process that is on 5037 and your adb commands should start working
Noyes answered 30/10, 2016 at 20:1 Comment(3)
This command does not work on Mac. I get netstat: illegal option -- oMaimaia
Recently had this issue, and I had two adb processes listening on port 5037. I killed both and re-ran the adb devices command. The command re-ran the ADB daemon and worked fine after that.Monday
On OSX you can use lsof -i tcp:5037 to see what's using that port.Eduardo
G
1

Something similar happened to me, I didn't have Android drivers correctly installed. You need to install Google USB Driver and then:

  1. Go to Control Panel Home

  2. Click on the "Device Manager" link.

  3. In the Device Manager locate your Android device (other devices). Then right-click on it and select "Update Driver Software".
  4. Select "Browse my computer for driver software".
  5. Select "Let me pick from a list of device drivers on my computer".
  6. Select "Show All Devices".
  7. Press the "Have Disk" button.
  8. Enter the path to the Google USB driver. Normally it is located in the following directory: C:\Program Files (x86)\Android\android-sdk\extras\google\usb_driver
  9. Select "Android ADB Interface" from the list of device types.
  10. Confirm the installation of the driver by pressing "Yes". And install it.

Complete tutorial here: http://visualgdb.com/KB/usbdebug-manual/ Hope it works!

Guiltless answered 4/8, 2016 at 12:56 Comment(0)
I
1

What ended up working for me was killing the server and then restarting it.

It takes a little bit of time but has worked for everytime.

Kill command adb kill-server¨

Start command adb start-server

The kill command will take a minut or so but it will work.

after that you can run your other adb commands

Incorrect answered 25/7, 2022 at 12:55 Comment(2)
Looks like there is some issue with adb in your case - usually kill/start takes few seconds.Wittenberg
Although this works, but I wouldn't call it a solutionGenerally
C
0

Try to:

Step1: Open android studio.
Step2: Choose Android device monitor.
Step3: At the device window: choose triangle icon then choose reset adb. (Try to repeat 2-3 times if it is not show some devices)
Conveyance answered 4/8, 2016 at 11:49 Comment(2)
In Android Device Monitor the device is online, I can take screenshot and works perfectly, but when I try to debug, no device appears in the list to deploy. lolForeconscious
Please check minSdkVersion in the grade file. May be it higher api of your device.Conveyance
M
0

Apart from checking for updated USB drivers...

In Windows, I've experienced hangs when using a USB hub with a harddrive, and/or other input devices attached. With my particular hardware setup, either my USB hardware is crappy, (maybe my latest USB hub is crappy) or the USB drivers for the USB controller are crappy, or I'm just running into what may be some more-or-less natural limitations to USB on the Windows platform (in regards to android hardware on Windows anyway).

EDIT: I'm particularly referencing USB3 here. I also happen to have a USB3 non-powered hub plugged into a USB2 port -- that port connects my mouse, an HDD, and my android device -- I've since had to re-think what is plugged where to ensure adb works properly.

One last helpful Windows tip, if you haven't restarted in days or weeks, might be a good idea to just restart and start fresh, and of course, Windows Updates (usually not a hindrance to how my android hardware works). Doing this can take care of another application using port 5037 (as mentioned by @par above).

I also experience issues when I try to batch several "adb pull" commands in sequence. I have been working on a setup to selectively pull a list of folders that aren't nested and thus can't be pulled in only one command that I know of (part of my custom backup solution). I sometimes find I have to pull one folder at a time. This is more likely related to my USB issues, and not so much and adb issue.

EDIT: Depending on what version of Win10 you use, you might have to manually initiate the update-check for your drivers, through the Device Manager. I actually managed to get an Android driver update by doing this recently. So far that update, and rethinking what is plugged where, things are working slightly better lately.

Musso answered 6/6, 2019 at 19:11 Comment(3)
welcome to stackoverflow! do you have any links to examples/articles of what's described in your answer to further elaborate these issues?Haileyhailfellowwellmet
I'm afraid no, not at the moment, just personal experience with my hardware. Both of my laptops exhibit some interesting quirks with USB3. Generally, one specific port is unstable and unreliable, while the other USB3 ports are not so. USB3 ports and cables usually don't work as consistently in my experience as USB2 ports and cables regarding android hardware. I do check for driver and BIOS updates, and one of my laptops actually has a BIOS update dated today! What are the odds...?Musso
Against all odds, my recent BIOS update (actually dated for today) lets me use both USB3 ports on my ASUS R510IU simultaneously. Unfortunately I can't find a detailed changelog, but before this update, I was completely unable to even have one HDD plugged in to both USB3 ports, only one specific port. They would both be non-responsive. Now they can be plugged in and do file transfers simultaneously.Musso
G
0

just like @par said and to kill the processes, just look at their PID number and to kill them you use "taskkill /PID (their pid) /f" and put the PID number there, /f is for force kill

Gonion answered 25/2, 2020 at 19:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.