Connect a Java debugger to a running activity

791 views
Skip to first unread message

teras

unread,
Feb 28, 2011, 12:11:20 PM2/28/11
to android-platform
Hello people!

I am trying to manually connect my IDE (Netbeans) to a running Android
Activity.
I know that there is already a Netbeans plugin that is able to do
this, but it has some bugs and I want to go my way, and see how things
should be done.


In order to launch the application in debug mode, I do something like
this:
adb shell "am start -D -n com.project.package/.ProjectActivity"
which starts the application in debug mode and waits for connections.

Now, in Netbeans I tried to connect to the 8700 port, as described in
the docs, but with no luck. By using DDMS I also found that the actual
port for this application is 8611, so I tried to connect there, no
luck again.
The error code in both cases was "handshake failed - connection
prematurally closed"

I also tried to port forward, as was mentioned in the documentation,
with a command like
adb forward tcp:8000 tcp:8700
or
adb forward tcp:8001 jdwp:558

Only the last option did something: it didn't fail with error but
again the IDE was frozen and no activity was performed.

Can anybody help me?

fadden

unread,
Mar 1, 2011, 4:29:01 PM3/1/11
to android-platform
On Feb 28, 9:11 am, teras <terat...@gmail.com> wrote:
> Now, in Netbeans I tried to connect to the 8700 port, as described in
> the docs, but with no luck. By using DDMS I also found that the actual
> port for this application is 8611, so I tried to connect there, no
> luck again.

The TCP ports only exist on your workstation. The VM is connected to
ADB through a "jdwp" port.

If you do a "remote debug" session to "localhost:8700" it will connect
to whichever VM you have highlighted in DDMS.
Reply all
Reply to author
Forward
0 new messages