Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug native code in Android Library

Tags:

My workspace layout is:

.
├── ApplicationLibrary
│   ├── AndroidManifest.xml
│   ├── ...
│   ├── jni
│   ├── libs
│   ├── ...
│   └── src
└── Application
    ├── AndroidManifest.xml
    ├── ant.properties
    └── ...

How can I debug the native library in Eclipse? Has anyone some hint about this?

like image 651
spacifici Avatar asked Sep 28 '12 11:09

spacifici


2 Answers

I was able to set breakpoints and debug native code in an android library on eclipse by adding the directory of the unstripped shared library/libraries to the debugger in the debug configurations dialog:

  1. Go to "Run" menu-> "Debug Configurations"
  2. Under "Android Native Application" in the left pane, select your application
  3. Under the "Debugger" tab click "Add..." in the "Shared Libraries" section.
  4. Browse to your android library project directory and add its subdirectory obj/local/armeabi.
  5. Apply and debug.

That seemed to work for me. Hopefully, you'll have the same luck...

Peace

like image 170
Jay Avatar answered Oct 21 '22 00:10

Jay


It is possible:

  1. Update your build config to include “NDK_DEBUG = 1”. Right click project -> properties -> C/C++ Build:

  2. Set a breakpoint in your C code.

  3. Right click on your project, select Debug As -> Android Native Application

For more details follow:

http://tools.android.com/recent/usingthendkplugin

like image 36
Rohit Avatar answered Oct 20 '22 23:10

Rohit