How to fix the error “Unable to open debugger port

2020-03-01 03:30发布

问题:

Error running Android Debugger (8600):
    Unable to open debugger port (localhost:8600):
    java.net.SocketException "Connection reset"

回答1:

I was able to fix this with these commands:

  • adb kill-server
  • adb start-server


回答2:

Try Restarting ANDROID STUDIO (Worked for me)



回答3:

In my case, there was another service running on my laptop(Windows) that was using the port 8600. I opened Task Manager and stopped the service. Now, I could debug my application normally without the above error.



回答4:

For me this problem started when i upgraded my Android Studio to new version.

Please go to options menu Build and choose Clean Project.

That is it project started to run again and error was gone.



回答5:

I solve the problem by checking my localhost.

Making sure 127.0.0.1 localhost.



回答6:

I tried other answers (e.g. restarting Android Studio) but they didn't solve this for me.

I had accidentally selected MTP (Media Transfer Protocol) in my Developer Options/USB Configuration. It started working once I set it to PTP (Picture Transfer Protocol).

EDIT: On reflection it's probably just that I changed the protocol because I've had the same issue since while on PTP. Hence I'm suggesting that the real answer is to change the protocol on the phone and, if you might need it, don't forget to change it back.



回答7:

If you using WiFi debug:

  1. Exit ANDROID STUDIO
  2. adb kill-server && adb start-server
  3. adb tcpip 5555
  4. adb connect [your wi-fi IP]:5555
  5. Start ANDROID STUDIO


回答8:

It could be that you need to wait for your code to stop compiling before you attached the debugger. I had a similar error and all I needed was patience.



回答9:

If none of solutions didn't workded, just restart your computer.