问题描述:mac 运行debug一直报错:Can't bind to local XXXX for debugger。
重启Android studio adb kill-server adb start-server,发现没有任何反应。而且每次
adb kill-server 之后,adb会倒计时10秒重启。非常诡异。
最后还是上stackoverflow 寻找到解决方案,原来是我之前在开发h5时,在hosts文件中设置了多个localhost导致的。
解决办法:
For Mac: Check your /etc/hosts file. Ensure that there is no any local ip for localhost. I added and forgot that i added a local ip (ex: 192.168.2.1) for localhost.
windows出现无法debug也是一样的。
C:\WINDOWS\system32\drivers\etc\host
And should contain this line :
127.0.0.1 localhost
If you have ipv6 ip address ::1 in your host file you need to delete or remark it.
原文地址:https://stackoverflow.com/questions/13198646/cant-bind-to-local-xxxx-for-debugger