This problem has been bugging me for ages and I can\'t seem to fix it or fully localize the source of the problem (although at times I can force it by allowing the phone to Stan
If your platform and platform-tools path is set:
Then from command prompt:
adb kill-server adb start-server
adb kill-server
adb start-server
It will definitely solve the problem as it restarts the daemon with the specific port