Debugging Android NDK C/C++ code in Eclipse - breakpoints are not hit

后端 未结 6 651
遥遥无期
遥遥无期 2020-12-01 14:59

I downloaded Android SDK Bundle for Linux and Android NDK. ADT was installed, I installed CDT.

I created a Android project and added native support (jni). Then I wro

6条回答
  •  孤街浪徒
    2020-12-01 16:03

    After struggling a lot to debug on Eclipse this is my recipe:

    Do the usual steps:

    • Add android.os.Debug.waitForDebugger(); before loading your native library. This might help.
    • Add APP_OPTIM := debug in Application.mk
    • Build with ndk-build NDK_DEBUG=1

    Then, what I found different:

    • Open a console and run:

    adb pull /system/bin/linker /obj/local/armeabi/linker

    Depending on your device you might have to write armeabi or armeabi-v7a. You only need to do it once (I noticed that running ndk-gdb manually was doing that. Executing that command manually the breakpoints started to work)

    • Finally, to debug use the menu "Run -> Debug As -> Android Native Application"

提交回复
热议问题