Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio unable to run project on device?

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

like image 723
Vivo Avatar asked Apr 21 '15 10:04

Vivo


3 Answers

adb kill-server

then

adb start-server

worked for me!

like image 153
Mohammad Alotol Avatar answered Oct 16 '22 11:10

Mohammad Alotol


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

like image 40
Isura Amarasinghe Avatar answered Oct 16 '22 11:10

Isura Amarasinghe


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

like image 9
durgaselvan swaminathan Avatar answered Oct 16 '22 11:10

durgaselvan swaminathan