Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug native code in an Android library project?

I am developing an Android library with native code. This library project is added as a library in an application project.

I would like to debug the library when the application project is using it.

I am pretty sure the settings in the library (makefiles, build command, compiler options) project are ok because I tried the debugger from within the library (I created a dummy Activity and unset "library") and it worked. I am also aware of the delay that might occur because of the time needed to load the dynamic library and I don't think it's the issue for the same reason.

In the Application project, I just added native code support set the build command as ndk_build NDK_DEBUG=1, but it never stops at breakpoints. Any idea would be greatly appreciated

like image 629
znat Avatar asked Apr 03 '13 21:04

znat


People also ask

How do I debug Android library?

While debugging when it prompt “Choose Sources”, Click on that option and select the “main” folder of the library module from your local codebase of the library. Now try to debug (by choosing 'step into' option etc), the debugger should able to get the source code.

How can you debug your app when it's already released?

In Eclipse, go to Window->Show View->Devices. Look at the Devices view which should now be visible, you should see your device listed. If your device isn't listed, you'll have to track down the ADB drivers for your phone before continuing. If you want to step through code, set a breakpoint somewhere in your app.

Which tools are used for debugging on the Android platform?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.


1 Answers

Try the answer by Jay in my question: debug native code in Android library. I had no time to test it by my self, but it looks promising. Let me know if it works.

like image 124
spacifici Avatar answered Nov 15 '22 18:11

spacifici