在运行Android程序时候,出现
the connection to adb is down and a severe error has occured
lanuch failded
然后在命令行输入adb decives,出现:
* daemon not running. starting it now on port 5037 *
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
原因是adb server的端口被占用。
解决方法(关闭eclipse):
在cmd窗口:
C:\Users\tsung>adb nodaemon server
cannot bind 'tcp:5037'
C:\Users\tsung>netstat -ano | findstr "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 4696
TCP 127.0.0.1:5037 127.0.0.1:64830 ESTABLISHED 4696
TCP 127.0.0.1:50250 127.0.0.1:5037 SYN_SEND 4584
TCP 127.0.0.1:64830 127.0.0.1:5037 ESTABLISHED 4584
......
C:\Users\tsung>tasklist | findstr "4696"
adb.exe 4696 Console 1 5,812 K
哦,原来是adb.exe进程占了adb的端口。
C:\Users\tsung>tasklist
Image Name PID Session Name Session# Mem Usage
========================= ======== ================
... ... ... ....
adb.exe 4696 Console 1 5,812 K
... ... ... ....
将这个进程kill掉:
C:\Users\tsung>taskkill /f /pid 4696
成功:已终止PID为4696的进程。
如果该命令提示无权限,可以去windows的“任务管理器”中“进程”那个窗口,找到这个进程,将它杀掉。
再运行adb devices,就可以。
C:\Users\tsung>adb devices
List of devices attached
G2W0214A17054261 device
然后再打开eclipse,就可以了。