If Android Studio is running on my development machine, when I launch the 
app on a device from the command line using this command:

    $ adb shell am start -D -n <activity> -a ...

Android Studio would immediately forward a port on the local host (8600 and 
up) to the jdwp port of the app, so that the debugger in Android Studio 
could debug the app if necessary.

Now, if, say, I would like to use a 3rd party debugger (rather than the 
debugger in Android Studio) to debug the app, I will need to connect that 
debugger to the port forwarded by Android Studio to that app to get the 
debugging to work.

*My question: How can I determine what that port is? *

Here are a couple of things I've tried (to no avail):
1. $ adb forward --list
      Alas, the forwarding done by Android Studio isn't shown.
2. $ adb forward tcp:9010 jdwp:<pid of the app>
      Connecting the debugger to 9010 failed, probably because the jdwp 
port is already locked up by Android Studio's port forwarding.
3. I can turn on DDMS and see the port assigned to the app. But what I need 
is an API or text output so that I can get that info programmatically?

You insight would be appreciated.



-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/32fa5ea5-bf79-4334-b577-c85385034ec2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to