Hello,
I'm having troubles with using a stand-alone java debugger with android apps on emulator. Apparently, any remote-capable java debugger such as jdb (or jswat) could be leveraged, by following the steps below (as I understand after reading here and there):
1) turn on the emulator, install your app on the emulator (adb install)
2) turn on the dalvik server (ddms)
3) on the emulator, run the "DevTools" app --> "Development Settings" --> select the app you want to debug, enable the "Wait for debugger" flag
4) again in the emulator, run your app; it will block, waiting for a debugger to attach, and dalvik will show a new process flagged by a "red bug"
5) on dalvik, select the red-flagged process; its debug port is thus forwarded to localhost:8700
6) hook the debugger to localhost:8700. With jdb you have to run "jdb -attach 8700"
As soon as the debugger is launched, your app on the emulator unblocks. So, it seems that the app has properly detected a debugger and thus runs free.
The point, however, is that it "runs free", that is, it will not wait for the debugger to issue a "run" command. So I have no chance to set up any breakpoints.
Following hints from 1,I've tried putting waiting loops at the beginning of my app, in the hope I'd have the time to set a breakpoint. When I try to set a breakpoint, jdb says "Deferring breakpoint XXX.YYY. It will be set after the class is loaded.", as the app was not running yet. But, if I then issue a "run" command, the answer is "Nothing suspended.", as the app was already running (and it is indeed).
With jswat you don't see al these messages but the final result is the same :-(
Needless to say, "jdb -attach" works just fine with non-android java apps running on localhost.
Any hints (except "please use eclipse")?
Am I just missing a stupid detail anywhere?
The app is a HelloWorld, build command is "ant debug".
Thank you in advance.