Search code examples
androidconnectionadb

Android studio Error during Sync: An existing connection was forcibly closed by the remote host


I've been debugging for months with a physical Samsung pad connected via USB and now I can't load the app on the device for debugging. I rebooted everything yesterday and it worked until this afternoon! I get the same error all the time. The ADB appears to be running on port 5037.

I'm disappointed in how buggy the development environment is and feel like I'm spinning my wheels like back in the Win3 days fighting the environment instead of the app. Any suggestions would be appreciated...

3:11 PM Gradle build finished in 2s 40ms
3:11 PM Error during Sync: An existing connection was forcibly closed by the remote host
3:11 PM Session 'app': Error Installing APK

I'm using USB debugging. I've tried everything I can find on SO and nothing works:

1) Rebooted both laptop and device many times
2) Deleted app from device
3) Manually updated the SDK to 8.1.0 (auto update fails with file size error)
4) Unplugged and tried a different USB port
5) Updated the Samsung Android ADB interface from Win7 device manager
6) Killed adb via task manager and SDK kill-server and start-server
7) Turned USB / Developer mode off and on again
8) Deleted the device from Win Device Manager; re-scanned; updated driver software

Solution

  • I can make this happen at will now and it seems like it happens when the device goes into sleep mode. So I'm debugging and all is working well and the problem occurs. I stop the app via Android Studio and reboot the Samsung pad. After that I get the funky temp device showing up and the ADB won't install. The fix is to unplug the USB cable. Wait about 1 minuet and plug back in. The temp device is gone and the pad shows up. All works well.