简体   繁体   中英

How to fix the error "Unable to open debugger port " in Android Studio?

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

我能够用这些命令解决这个问题:

  • adb kill-server
  • adb start-server

尝试重新启动 ANDROID STUDIO(为我工作)

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.

I solve the problem by checking my localhost.

Making sure 127.0.0.1 localhost .

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.

I tried other answers (eg 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.

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

如果没有解决方案,请重新启动计算机。

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.

I did spent quite an amount of time by trying below things:

Finally a small change in my /etc/host file resolved this issue. I commented from 0.0.0.0 and ::1 for localhost local DNS entries and enabled only 127.0.0.1

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM