Debugging Android NDK native apps

Well NDK_DEBUG=1 and debuggable flag in manifest set to true are required. When you build the app,in your project/libs/armeabi, there should be a gdb.setup file. There is symbol search path there, check whether it is valid. And did you try this:

ndk-gdb --start --verbose --force

And looks like you are getting a null pointer exception.


In latest versions of NDK and Eclipse plug-in you can right click on package and choose Debug as -> Android Native Application


Make sure that you load your native library in either a launchable activity or in your Application class. Otherwise it wouldn't work and you'll get the following error No symbol table is loaded. Use the "file" command..

For example in Application class:

import android.app.Application;

public class MyApp extends Application {

    static {
        System.loadLibrary("Name");
    }

    public static native int doSomething();
}

Name is the name of your library (.so file) without the lib part.