Thursday, April 25, 2013

Debugging Remote Applications With ECLIPSE

DEBUGGING REMOTE APPS WITH ECLIPSE

1.  Must have the Android SDK plugin for Eclipse. Instructions to install it here:

2.  From the DDMS perspective or adb shell, find the port of the process that you want to debug.

3.  From the Debug perspective, go to Run, then Debug Configurations… Select Remote Java Application and click the New Launch Configuration button on the top left corner of the screen.


4.  Create a new configuration. Enter a name for it and change the Port to the corresponding port of the process that will be debugged.


5.  Click on the source tab, then click Add…
    

Select File System Directory and click OK.
              

Browse to the location of android’s framework and make sure that the Search subfolders box is checked. Then click OK. Repeat the process for any other paths that contain source files required for your application.
           

6.  Click Apply and then click Debug to start debugging the process previously selected.

7.  When the debugging starts, the Debug perspective should look similar to this:


After hitting a breakpoint, the debugger will show the file and line where the breakpoint is and the stack trace:


For subsequent debugging sessions of other processes, just go to STEP 3, change the port number to the port number of the new process that you want to debug, click Apply and then Debug, nothing else has to be reconfigured.

No comments: