16

Using Intellj-idea I'm trying to debug into the Android source API 17 but when I set breakpoints in the platform source they are being ignored when run. Looking at the breakpoint whilst debugging there is a cross in it with a message stating "no executable code found at line 15,508 in class android.view"

I've tried running against an emulator with API 17 set as well as a phone with Android 4.2.2 but both don't work. I can sort of debug into the methods but the cursor jumps around.

So I'm guessing that there is no debug info as well as some optimisations that have gone on. So my question:

Is there a way I can properly debug the Android Platform from the perspective of my application and set breakpoints that work in it? Maybe a an emulator that has been been built with debug info?

Any help would be appreciated?

Regards Lee

LeeAlexander
  • 186
  • 8

1 Answers1

3

It depends on what application you are trying to debug: your own application, a system application such as android.process.acore.

To debug platform source running in your own application

The main issue is the line numbers of the platform source you have downloaded on your computer must match what is running on the device. Your best bet will be to debug on Google Nexus device such as the Nexus 5 or Nexus 7 since it should be running a compiled version of the source exactly as it was released by Google which you downloaded with the Android SDK. Just add the sourcepath to the sdk in IntelliJ, attach the debugger and set the breakpoint. Make sure you choose the same API level source as is running on the device. That should do it.

To debug platform source running in a system application

You will need eng build of the Android platform to debug system processes. If you haven't built and installed the Android platform before it is quite a bit of work and requires an unlocked bootloader. Maybe there are prebuilt eng builds of cyanogenmod or something that can be downloaded but I can't find any after some trivial Googling. You may also make an eng build of AOSP yourself and run the emulator on your machine. See Running emulator after building Android from source and the "Choose a target" section on the AOSP site for info on building your own eng build if you are feeling very ambitious.

Community
  • 1
  • 1
satur9nine
  • 13,927
  • 5
  • 80
  • 123