I am trying to attach the ndk-gdb to my Android application.
I am using is Android-ndk-r6b
and device is Android 2.3,Samsung Galaxy S II.
I followed all the steps in this example Click here for the example
And also I tried with one application, when I am trying to attach gdb with another application but the verbose showing that it is always getting attached to the first application itself
Found package name: <1st attached package name>
I tried to launch the ndk-gdb
using this command for the first time:
ndk-gdb --start --force --verbose
I tried to attach to another application with the below command but not able to succeed:
ndk-gdb --launch=com.example.hellogdbserver.HelloGdbServer --force --verbose
I am always getting the below error with first application:
ERROR: Non-debuggable application installed on the target device.Please re-install the debuggable version!
This is complete shell log which i am getting
sh-4.1$ ndk-gdb --verbose --start --force
Android NDK installation path: /cygdrive/c/Android/android-ndk
Using default adb command: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.26
Using final ADB command: '/cygdrive/c/Android/android-sdk-windows/platform-tools/adb'
Using auto-detected project path: /cygdrive/d/EclipseTestWorkspace/hello-gdbserver
Found package name: com.example.hellogdbserver
ABIs targetted by application: armeabi
Device API Level: 10
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.example.hellogdbserver/lib/gdbserver
Using gdb setup init: /cygdrive/d/EclipseTestWorkspace/hello-gdbserver/libs/armeabi/gdb.setup
Using toolchain prefix: /cygdrive/c/Android/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: /cygdrive/d/EclipseTestWorkspace/hello-gdbserver/obj/local/armeabi
ERROR: Could not extract package's data directory. Are you sure that
your installed application is debuggable?
sh-4.1$
Please let me know how can I resolve the above error and also how to attach to new package.
My phone is not rooted. Hope this wont affect the gdb.
This was not helpful as well Link to similar problem. As my phone is new phone and dont have any app, other than the current developing app. (Only packages which come along with the Samsung phone are present. No app is downloaded from the market. )
Thanks & Regards,
SSuman185
Please go through the link Debugging native code in android app using the android ndk gdb
Please first ensure that you are building the debuggable version of the app. The AndroidManifest.xml file should include the android:debuggable="true" tag.
You can also check it by finding the APK file in the bin directory, unpacking it (it's just a renamed ZIP file) and ensuring that lib\armeabi folder contains the gdbserver file.
If both conditions above are met, try installing the package on the device manually:
<android-sdk>\platform-tools\adb.exe install -r <your-package-file.APK>
Please carefully observe the output of adb.exe. If it displays an error, it might explain your problem.
This problem will arise if you try to debug a library project. ndk-gdb is unable to attach to a project that is not the "main" one.
You have to put your jni code into the starting application project.
make sure you have APP_OPTIM in jni/Application.mk set to debug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With