最近开发过程中Android studio debug过程中经常报:
Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If it's being used by something else, choose a new port number in the preferences.
下午4:13 Can't bind to local 8601 for debugger
下午4:15 Can't bind to local 8602 for debugger
下午4:15 Can't bind to local 8603 for debugger
下午4:15 Can't bind to local 8604 for debugger
确定没开DDMS情况下尝试过电脑重启、AS重启、adb kill start server、手机重连及usb调试关闭再打开,仍然解决不了。Google了一圈,网友提供的方法也无法解决debug问题。
自己研究了下,adb kill-server后AS会尝试重新开启adb,经过10次重连,重新启动adb,然后就输出Can't bind to local xxxx for debugger,是不是因为as自动重启adb机制导致的呢。尝试了一下,通过以下步骤可以解决问题:
1.AS 的terminal中执行 adb kill-server,此时Event Log窗口会显示重启adb,在adb重启成功之前拔掉连接的手机,关闭AS;
2.连接手机,terminal执行 adb kill-server,adb start-server;
3.打开AS,发现可以debug了,问题解决,perfect!