9

I am getting the following error. I couldn't find why this happens on the internet either.

ddms: Can't bind to local 8601 for debugger
ddmlib: Broken pipe
java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69)
    at sun.nio.ch.IOUtil.write(IOUtil.java:40)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:336)
    at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
    at com.android.ddmlib.Client.sendAndConsume(Client.java:675)
    at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:342)
    at com.android.ddmlib.Client.requestAllocationStatus(Client.java:521)
    at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:847)
    at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:815)
    at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:775)
    at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:664)
    at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:46)
    at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:592)

ddmlib: Broken pipe
java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69)
    at sun.nio.ch.IOUtil.write(IOUtil.java:40)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:336)
    at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
    at com.android.ddmlib.Client.sendAndConsume(Client.java:675)
    at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:342)
    at com.android.ddmlib.Client.requestAllocationStatus(Client.java:521)
    at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:847)
    at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:815)
    at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:775)
    at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:664)
    at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:46)
    at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:592)

Note:

My device Nexus that runs 5.0.2

My android studio is 1.0.1

My platform is mac mavericks

I am just trying to run the Login template app nothing more.

Thanks

Xakep
  • 63
  • 1
  • 2
  • 10
Vivo
  • 768
  • 1
  • 8
  • 20
  • 2
    Sometimes I get the same error, but I see it, when I have AndroidStudio and eclispe opened. SO I have to close both, and open only AS, or Eclipse to be recognised. – Shudy Apr 21 '15 at 10:38

8 Answers8

11
adb kill-server

then

adb start-server

worked for me!

Mohammad Alotol
  • 1,409
  • 15
  • 23
9

Restart your computer and check

If you are using Linux try to kill the port using

fuser -k 8601/tcp

If you are using mac try to kill the port using

lsof -P | grep '8601' | awk '{print $2}' | xargs kill

Here is the ref for osx

Community
  • 1
  • 1
  • I get following error when I try in the terminal `Unknown option: k` seems like it can be helpful in unix environment. – Vivo Apr 22 '15 at 15:38
  • 5
    OSX `lsof -P | grep '8601' | awk '{print $2}' | xargs kil` – Vivo Apr 22 '15 at 15:47
9

You might have both Android studio and Eclipse open

  • Close both the applications and open the one which you are going to use.

  • if it didn't solve the problem the port is used by some other app so restart the system

  • or else kill port using a command if the problem still remains unsolved

avandeursen
  • 8,458
  • 3
  • 41
  • 51
  • This also goes if you have some Eclipse-based program open, even if Eclipse as a stand-alone program isn't open. For me the culprit was the Eclipse-based "b-folders" (obscure program for safekeeping passwords and notes). – Elias Mossholm May 13 '17 at 16:36
8

There is nothing that much serious with this exception. Simply you need to unplug your USB cable from the port, restart your device and restart your Android Studio as well. Surely this exception will be removed. This worked for me, hope you will also get rid of it.

Maniya Joe
  • 761
  • 6
  • 24
4

This is just a dumb thing done by the system which as trouble finding localhost it seems. Take a look in here, many people have this question, and it's quite easy to fix.

Community
  • 1
  • 1
SilentKnight
  • 13,761
  • 19
  • 49
  • 78
4

I am on OS X 10.9.5. Sometimes I get this error too. Usually I disconnect the device -> restart the adb (or quit the android studio and then start again)->connect the device -> run again. [make sure you are not running adb from another eclipse/studio]

See if this helps you.

Vivo
  • 768
  • 1
  • 8
  • 20
Amit K. Saha
  • 5,871
  • 2
  • 27
  • 35
1

Simply using adb kill-server addressed the problem for me.

ThomasW
  • 16,981
  • 4
  • 79
  • 106
0

I tried all the solutions above: restarted studio, restarted devices, killed all studio processes, killed the ports listening...

Eventually the only thing that worked was File -> Invalidate Caches / Restart...

Also changing the USB cable could help...

peresisUser
  • 1,680
  • 18
  • 23