Android 出现“Can't bind to local 8602 for debugger”错误的解决方法
Android出现“Can'tbindtolocal8602fordebugger”错误的解决方法
为了适应Android5.0的开发,把JDK升级到了1.7,然后在ADT中想调试一下程序(我连接的真机),结果报错如下:
[2015-04-2315:31:37-ddms]Can'tbindtolocal8602fordebugger [2015-04-2315:31:37-ddmlib]您的主机中的软件中止了一个已建立的连接 。 java.io.IOException:您的主机中的软件中止了一个已建立的连接。 atsun.nio.ch.SocketDispatcher.write0(NativeMethod) atsun.nio.ch.SocketDispatcher.write(UnknownSource) atsun.nio.ch.IOUtil.writeFromNativeBuffer(UnknownSource) atsun.nio.ch.IOUtil.write(UnknownSource) atsun.nio.ch.SocketChannelImpl.write(UnknownSource) atcom.android.ddmlib.JdwpPacket.writeAndConsume (JdwpPacket.java:213) atcom.android.ddmlib.Client.sendAndConsume(Client.java:642) atcom.android.ddmlib.HandleHeap.sendREAQ (HandleHeap.java:348) atcom.android.ddmlib.Client.requestAllocationStatus (Client.java:488) atcom.android.ddmlib.DeviceMonitor.createClient (DeviceMonitor.java:835) atcom.android.ddmlib.DeviceMonitor.openClient (DeviceMonitor.java:803) atcom.android.ddmlib.DeviceMonitor.processIncomingJdwpData (DeviceMonitor.java:763) atcom.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop (DeviceMonitor.java:652) atcom.android.ddmlib.DeviceMonitor.access$100 (DeviceMonitor.java:44) atcom.android.ddmlib.DeviceMonitor$3.run (DeviceMonitor.java:580)
根据错误信息猜想应该是debug端口被占用了,本以为是升级1.7引起的,stackoverflow上也有人说卸掉1.7,重新装1.6就好了。想想不应该啊,Android5.0要求JDK必须升级到1.7的,忽然发现我同时还在跑AndroidStudio,同样也连接我的手机,抓到元凶,一定就是这货了!果断关掉AndroidStudio,然后在ADT中clean下工程,重新运行程序就OK了。如果碰到上述情况,也许不一定是AndroidStudio占用了debug端口,或者还有其他进程占用,请不要怀疑是JDK1.7的问题。
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!