3

I am using Android Studio 1.5 and currently working on a project. Whenever I am trying to debug or attach the debugger to the app I am working on to fix bugs, the debugger is NOT able to connect; therefore the app freezes on the android device. Note that it randomly works and connects properly some time to time (like 2 out 10 times). I get this error in the logs:

Error running Android Debugger (8600): Unable to open debugger port (localhost:8600): java.io.IOException "handshake failed - connection prematurally closed" 9:57:00 AM Error running Android Debugger (8600): Unable to open debugger port (localhost:8600): java.io.IOException "handshake failed - connection prematurally closed" 9:57:25 AM Adb connection Error:EOF 9:57:25 AM Connection attempts: 1

How can I fix this issue and be able to easily debug my app ? Thanks in advance.

ngaspama
  • 371
  • 4
  • 10

3 Answers3

3

You can try restarting adb. From Android Studio, click "Terminal" (bottom of screen). At the prompt enter: adb kill-server, then adb start-server. Try debugging again.

Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106
  • I tried "adb kill-server, then adb start-server" on the terminal and it still did not work. – ngaspama Feb 29 '16 at 15:24
  • I finally figured it out. It was a bad usb cable. After getting a brand new "gold plated" usb cable, I am no longer experiencing this issue. – ngaspama Aug 17 '16 at 15:22
  • Thanks! After installing SDK packages debugger didn't work. I restarted ADB. – CoolMind Aug 16 '23 at 06:19
0

Whenever this happens to me, I just close the emulator or re-plug in my hardware device and Run the app. Android studio automatically restarts adb.

You can also try double clicking on adb in /android-sdk/platform-tools

Rishabh Tatiraju
  • 172
  • 1
  • 10
  • I did it multiple times; but did not get it to work consistently. This is a really weird issue. I might have to reinstall the android sdk. – ngaspama Feb 29 '16 at 15:27
  • @ngaspama If I were you I would check with another device to rule out a bad android-sdk package, and update the phone drivers on the PC. – Rishabh Tatiraju Mar 01 '16 at 18:02
  • It was a bad usb cable for me. Problem solved now. Thank you very much. – ngaspama Aug 17 '16 at 15:24
0

If none of the other solutions worked for you (as it didn't for me), I suggest to try to do a clean reinstall of the Platform tools.

1 - Start the standalone SDK Manager.

From Android Studio: Tools->Android->SDK manager, SDK Tools tab, click start standalone SDK manager.

2 - Close Android Studio.

3 - In SDK manager, in the Tools folder: check Android SDK Platform-Tools and click on the Delete packages button in bottom right corner.

4 - In Explorer, delete the folder android-sdk-path\platform-tools.

5 - Back in SDK manager: re-check Android SDK Platform-Tools and click on the Install packages button.

qwlice
  • 556
  • 7
  • 23