Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android framework debugging in Eclipse

I'm working on a project where I'm making changes to the android framework sources. What's the best approach to do this in Eclipse and be able to debug? I've seen posts to attach the android source in Eclipse,but that's the 'standard' source code, not my own version.

At the moment I just make changes to the framework in a text-editor and build via commandline every time, run the emulator from commandline and start a adb logcat session to see if there aren't any exceptions, but there's got to be another (more productive/workable) way to do this?

like image 987
b74ckb1rd Avatar asked Nov 13 '12 10:11

b74ckb1rd


1 Answers

There is an explanation how to attach debugger in the official documentation that you can find here. In my case the steps differ (Eclipse 3.7.2 and the last android tools):

  1. Run > Debug Configurations...
  2. Right-click "Remote Java Application", select "New".
  3. Pick a name, i.e. "android-debug" or anything you like.
  4. Set the "Project" to your android project name.
  5. Keep the Host set to "localhost", but change Port to 8700.
  6. Click the "Debug" button and you should be all set.
  7. Then go to DDMS perspective and select a process you want to debug (select the process in the list of processes and then click on green bug icon). If you want to test your service, I think that it is a part of system_server process.
  8. Now you can switch to debug perspective.

As it is claimed in the documentation:

Once you do, you should see a list of threads; if you select one and break it (by clicking the "pause" icon), it should show the stack trace, source file, and line where execution is at. Breakpoints and whatnot should all work.

like image 88
Yury Avatar answered Sep 17 '22 17:09

Yury