Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

What worked for me is using eclipse to edit/browse AOSP code, but use terminal for building AOSP code. Please check Debugging Android framework services. This blog explains how to setup your eclipse project that doesn't break AOSP builds and then debug using that project. Pretty similar to what the previous answer described, but uses a shadow folder so that eclipse build artifacts don't break AOSP build.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top