Android Studio unable to run project on device?

2019-06-16 09:39发布

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

8条回答
一纸荒年 Trace。
2楼-- · 2019-06-16 09:54

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.

查看更多
\"骚年 ilove
3楼-- · 2019-06-16 09:56

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.

查看更多
劫难
4楼-- · 2019-06-16 10:06

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

查看更多
Animai°情兽
5楼-- · 2019-06-16 10:07

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

查看更多
冷血范
6楼-- · 2019-06-16 10:09

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.

查看更多
ゆ 、 Hurt°
7楼-- · 2019-06-16 10:10

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

查看更多
登录 后发表回答