I've been troubleshooting this for hours and I'm so lost.
My Android Studio (Windows) has stopped being able to find devices, which I assumed was some kind of problem with adb. I navigated to the platform-tools folder and tried to run adb from there:
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>adb devices
adb.exe: failed to check server version: protocol fault (couldn't read status): No error
To fix this, I tried every solution I could find:
- Restarting
- Stopping adb.exe from task manager
- Reinstalling platform tools and Android Studio
None of this worked. So I went to check if there was something using port 5037 (the default Android Studio port):
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>netstat -aon|findstr "5037"
TCP 0.0.0.0:5037 0.0.0.0:0 LISTENING 16420
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>tasklist|findstr "16420"
svchost.exe 16420 Services 0 13,744 K
If I then go into Task Manager and stop process 16420 and try to run adb again:
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
The problem here is that svchost.exe will randomly start up again and take over the port and if I restart, I need to do this whole process again.
Any idea why this would be happening?