5

I've scoured around and haven't seen a satisfactory answer (so maybe there isn't one). I'm running Android Studio on my Mac at work and there is a conflict with the debugging port 8600.

I was under the impression that if there was a conflict, Android Studio would choose a different port by incrementing up from 8600. It appeared to do this once yesterday when it ran on 8601, but maybe the stars were correctly aligned yesterday because it's not doing it today :(.

Is there a way to change that debug base port from 8600 to something of my choosing? This would be MUCH easier than changing the process it is conflicting with, I promise. Any suggestions on what I'm doing wrong would be greatly appreciated as I feel like I'm missing something obvious. Thanks!

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
blh83
  • 495
  • 5
  • 17
  • There are ways to do it in DDMS. Not sure about Android Studio directly. https://stackoverflow.com/questions/2800386/could-not-open-selected-vm-debug-port-8700 – OneCricketeer Dec 23 '16 at 17:40
  • Are you able to see what else is claiming port 8600? http://stackoverflow.com/questions/28283087/unable-to-open-debugger-port-java-net-connectexception-connection-refused – Michael Dodd Dec 23 '16 at 17:41
  • yes, @MichaelDodd. It's an ssh thing from a docker machine that my employer uses in one of their micro services. Which is why I am hoping there is a way to change this in Android Studio. – blh83 Dec 23 '16 at 17:45

1 Answers1

2

Android Device Monitor -> Window -> Preferences -> Android -> DDMS -> Base Local Debugger Port

DDMS screenshot, Android -> DDMS

Michael Dodd
  • 10,102
  • 12
  • 51
  • 64
  • Even after setting this, if you start the debugger with your Android device you see "Connected to the target VM, address: 'localhost:8600', transport: 'socket'", so it seems that it doesn't change the default 'debug' port. Note, this is after changing the 'Base local debugger port' to 8700 (or anything else) – Justin Dec 23 '16 at 18:05
  • Even after restarting the ADB server? – Michael Dodd Dec 23 '16 at 18:08
  • @MichaelDodd I have tried the setting as you suggested, and after restarting adb and Android Studio I still get this in the Event Log: Error running app: Unable to open debugger port (localhost:8600). What's odd is that in Android Device Monitor it shows my connected phone and shows the port as 8601 (I changed it to that per your suggestion) but it's like Android Studio is still seeing some other setting. I'll keep playing around and accept your answer if it's just me doing something wrong. – blh83 Dec 23 '16 at 18:12
  • 1
    Android Device Monitor seems to be deprecated and removed from AndroidStudio 3.2 without a (documented) replacement for this purpose, per: https://developer.android.com/studio/profile/monitor Great. – Ribo Jun 08 '20 at 18:02