'Failed to debug Android app with physical device

After testing my Android app with Android studio on several devices with no problem, since a few days I get the following log in the console:

14:48 Unable to open connection to ADB server: java.io.IOException: Can't find adb server on port 5037, IPv4 attempt: Connection refused: connect, IPv6 attempt: Connection refused: connect

14:48 Failed to start monitoring 19134523021744

14:49 * daemon not running; starting now at tcp:5037

14:49 * daemon started successfully

14:49 * Failed to start monitoring 19134523021744

and it continues like this... starting the deamon thread and immediately after that it reports the errors above. In ther device list of Android Studio my physical devices continue to appear and disappear from the list.

It looks like the ADB is working intermittently and I'm not able to debug anymore. When I try to launch the app I get an error saying that "the device is offline", no matter which physical device I use. It works only with the emulator. I tried to restart the PC several times, checked the settings, to no avail. Any hint ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source