6

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

Gustavo Piucco
  • 467
  • 1
  • 7
  • 17

6 Answers6

14

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
par
  • 141
  • 1
  • 3
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!

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)
sonnv1368
  • 1,547
  • 12
  • 17
  • 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. lol – Gustavo Piucco Aug 04 '16 at 12:06
  • 2
    Please check minSdkVersion in the grade file. May be it higher api of your device. – sonnv1368 Aug 04 '16 at 12:11
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.

Jeb Dude
  • 1
  • 2
  • welcome to stackoverflow! do you have any links to examples/articles of what's described in your answer to further elaborate these issues? – Matthew Thurston Jun 06 '19 at 19:23
  • 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...? – Jeb Dude Jun 06 '19 at 19:49
  • 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. – Jeb Dude Jun 06 '19 at 20:25
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

Kream
  • 131
  • 1
  • 3
  • 12
0

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

Belcookies
  • 23
  • 6