Hello,
I'm debugging an issue with a native C library that's crashing only on
Gingerbread. I spent yesterday reading countless how-to's, discussion
threads, and documentation about getting ndk-gdb to run in order to
debug with my device. I verified that debuggable is set to true in the
manifest, built with ndk-build, installed the .apk on the device,
started the application, and started ndk-gdb. I get this error:
Found device gdbserver: /data/data/
com.xfinity.tv/lib/gdbserver: No
such file or directory
ERROR: Non-debuggable application installed on the target device.
Please re-install the debuggable version!
Most advice I've seen for this is rebuild with ndk-build, build
project, install again, start the app, and run ndk-gdb. I've repeated
this process many times, tried using android-ndk-r4b instead, and even
tried hacking around in the android-ndk-r5b/build/core/ (don't worry
I've since restored them to their pristine state) to ensure that
debugging wasn't being stripped out. Nothing is working!
Has anyone experienced a similar issue? What am I missing here?
Thanks,
Corey
===============================================================
Specs/Tools
===============================================================
Mac OSX 10.6.6
Nexus S
android-ndk-r5b (also have android-ndk-r4b)
mvn
===============================================================
Build/Install Process
===============================================================
> ndk-build # from the jni directory
> mvn clean install # from the project directory
> adb install -r target/blah.apk
start app on device
> ndk-gdb
===============================================================
Android.mk contents
===============================================================
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := clibrary
LOCAL_SRC_FILES := blah.c blah2.c blah3.c
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS := --std=c99 -ggdb -g
APP_OPTIM := debug
LOCAL_CFLAGS += -O0 -g
include $(BUILD_SHARED_LIBRARY)
===============================================================
Output of "ndk-build NDK_DEBUG=1 NDK_LOG=1"
===============================================================
Android NDK: NDK installation path auto-detected: '/usr/local/android-
ndk-r5b'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: darwin
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to darwin-x86
Android NDK: Host awk tool was auto-detected: awk
Android NDK: Host awk test returned: Pass
Android NDK: This NDK supports the following toolchains and target
ABIs:
Android NDK: arm-eabi-4.4.0: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-4.4.3: armeabi armeabi-v7a
Android NDK: x86-4.2.1: x86
Android NDK: Found platform root directory: /usr/local/android-ndk-r5b/
platforms
Android NDK: Found supported platforms: android-3 android-4 android-5
android-8 android-9
Android NDK: PLATFORM android-3 supports: arm
Android NDK: ABI arm sysroot is: /usr/local/android-ndk-r5b/
platforms/android-3/arch-arm
Android NDK: PLATFORM android-4 supports: arm
Android NDK: ABI arm sysroot is: /usr/local/android-ndk-r5b/
platforms/android-4/arch-arm
Android NDK: PLATFORM android-5 supports: arm
Android NDK: ABI arm sysroot is: /usr/local/android-ndk-r5b/
platforms/android-5/arch-arm
Android NDK: PLATFORM android-8 supports: arm
Android NDK: ABI arm sysroot is: /usr/local/android-ndk-r5b/
platforms/android-8/arch-arm
Android NDK: PLATFORM android-9 supports: arm
Android NDK: ABI arm sysroot is: /usr/local/android-ndk-r5b/
platforms/android-9/arch-arm
Android NDK: Found stable platform levels: 3 4 5 8 9
Android NDK: Found max platform level: 9
Android NDK: Looking for AndroidManifest.xml in {PROJECT_DIRECTORY}/
jni
Android NDK: Looking for AndroidManifest.xml in {PROJECT_DIRECTORY}
Android NDK: Found it !
Android NDK: Found project path: {PROJECT_DIRECTORY}
Android NDK: Parsing {PROJECT_DIRECTORY}/jni/Application.mk
Android NDK: Found APP_PLATFORM=android-9 in {PROJECT_DIRECTORY}/
default.properties
Android NDK: Defaulted to APP_BUILD_SCRIPT={PROJECT_DIRECTORY}/jni/
Android.mk
Android NDK: Application 'local' forced debuggable through NDK_DEBUG
Android NDK: Selecting optimization mode through Application.mk: debug
Android NDK: Adding import directory: /usr/local/android-ndk-r5b/
sources
Android NDK: Building application 'local' for ABI 'armeabi'
Android NDK: Using target toolchain 'arm-linux-androideabi-4.4.3' for
'armeabi' ABI
Android NDK: Looking for imported module with tag 'cxx-stl/system'
Android NDK: Probing /usr/local/android-ndk-r5b/sources/cxx-stl/
system/Android.mk
Android NDK: Building application 'local' for ABI 'armeabi-v7a'
Android NDK: Using target toolchain 'arm-linux-androideabi-4.4.3' for
'armeabi-v7a' ABI
Android NDK: Looking for imported module with tag 'cxx-stl/system'
Android NDK: Probing /usr/local/android-ndk-r5b/sources/cxx-stl/
system/Android.mk
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi-v7a/
gdbserver
Gdbsetup : libs/armeabi-v7a/gdb.setup
Compile thumb : clibrary <= blah.c
Compile thumb : clibrary <= blah2.c
Compile thumb : clibrary <= blah3.c
SharedLibrary : libclibrary.so
Install : libclibrary.so => libs/armeabi/libclibrary.so
Compile thumb : clibrary <= JNIInit.c
SharedLibrary : libclibrary.so
Install : libclibrary.so => libs/armeabi-v7a/libclibrary.so
===============================================================
Output of "ndk-gdb --verbose"
===============================================================
Android NDK installation path: /usr/local/android-ndk-r5b
Using default adb command: /usr/local/android-sdk-mac_86/platform-
tools/adb
ADB version found: Android Debug Bridge version 1.0.26
Using final ADB command: '/usr/local/android-sdk-mac_86/platform-tools/
adb'
Using auto-detected project path: /Users/clatis200/workspace/mobile/
android/AndroidXfinityTV/XfinityTVApp
Found package name:
com.xfinity.tv
ABIs targetted by application: armeabi armeabi-v7a
Device API Level: 9
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi-v7a
Found debuggable flag: true
Found device gdbserver: /data/data/
com.xfinity.tv/lib/gdbserver: No
such file or directory
ERROR: Non-debuggable application installed on the target device.
Please re-install the debuggable version!