Environment: Latest NDK + Eclipse Juno + ADT + CDT. Everything is up to date.
When I try to debug my Android application natively, I get the following error:
warning: Unable to find dynamic linker breakpoint function.
GDB will retry eventurally. Meanwhile, it is likely
that GDB is unable to debug shared library initializers
or resolve pending breakpoints after dlopen().
To ensure it is not my specific application, I created a simple dummy application. Here are the steps I took.
- From Eclipse, create a new Android application project (with min-sdk 16 and target-sdk 21)
- Added a class:
package com.test.mytest1;
public class MyNative {
static {
android.os.Debug.waitForDebugger();
System.loadLibrary("mytest1");
}
native public static void init();
}
Note that I have added a line to wait for the debugger to initialize.
Called MyNative.init() from MainActivity's onCreate() method.
From preferences, fixed NDK to point to C:\adt\ndk directory.
From the project menu, selected Android Tools-->Add Native Support.
From Properties->C++ Build, set build command to "ndk-build NDK_DEBUG=1"
Here is the code in mytest1.cpp:
static int x = 0;
JNIEXPORT void JNICALL Java_com_test_mytest1_MyNative_init(JNIEnv *, jclass)
{
x++;
}
- Added Application.mk in jni directory:
APP_ABI := armeabi-v7a
APP_PLATFORM := android-16
Now, when I try to run the app as native application, it fails with the above mentioned message.
When I look at the apk file, lib/armeabi-v7a does contain gdbserver as well as libmytest1.so files.
The app does work. If I add a log() statement in my native method, it does get displayed in LogCat.
I am confused and tired. A simple thing like thing should just work. Wondering if you can share what you did differently to make it work. Regards.