I don't remember how many times I encountered this problem when I learned to debug Android programs with adb commands:
Open Eclipse or Android Studio and find that no device can be found. Then enter the command adb shell in the dos window. The following problems occur:
adb devicesadb server is out of date. killing... ADB server didn't ACK* failed to start daemon *error: unknown host service
Every God on the Internet explains why: the port of adb (5037) is occupied.
After trying various methods, the general method can solve the problem:
In the cmd window:
C:\Users\xiaoming>adb nodaemon server
cannot bind 'tcp:5037'
C:\Users\xiaoming>netstat -ano | findstr "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 8516
TCP 127.0.0.1:5037 127.0.0.1:59163 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:59164 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:59167 TIME_WAIT 0
......
C:\Users\xiaoming>tasklist | findstr "8516"
sjk_daemon 8516 Console 1 3,071 K
Oh, it turns out that the sjk_daemon process takes up the port of the adb.
C:\Users\xiaoming>tasklist
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
System 4 Services 0 1,128 K
sjk_daemon 963 Console 1 3,071 K
tasklist.exe 1260 Console 1 5,856 K
kill this process:
C:\Users\xiaoming>taskkill /f /pid 963
If this command prompt has no privileges, you can go to the window of "process" in the "task manager" of windows, find the process and kill it.
If you run adb devices again, there will be no problem.
C:\Users\xiaoming>adb devices
4df7f482396a301d device
This is online. https://blog.csdn.net/liranke/article/details/42524851#reply This elder brother's solution, but I found that using windows Task Manager to kill this process does not work, so I still hope to be able to kill the process in the dos window is more useful!