Debugging Native code??

Put problems with the Android NDK in this forum.

Debugging Native code??

Postby Ramana » Fri Jul 09, 2010 2:00 pm

Hi ,
I am working on Ndk-r4 sample hello-jni project on windows using cygwin.Built the library using ndk-build command.Started eclipse and imported the hello-jni project.Compiled the project using 1.6 sdk and got the hellojni.apk.Now if i want to debug the native code what are the steps tp be followed.I have used ndk-gdb it always throws Non debuggable application installed on the target device.Please reinstall the debuggable version.
Is debugging supported in 1.6 sdk or it works only with 2.2 sdk.

Junior Developer
Junior Developer
Posts: 17
Joined: Wed May 19, 2010 6:57 am


Re: Debugging Native code??

Postby julienr » Thu Aug 05, 2010 1:23 pm

Debugging is officially only supported in 2.2.
With version prior to 2.2, you can't really do debugging on your native code.
If you want to find memory leaks, have a look at that thread.
When your application crash, you will get a stack trace in logcat. There are some tips on how to make sense of this logcat in this thread..

This document is also interesting, but it is intended for people building their own version of Android from sources, so chances are it might not work with the phone manufacturer's firmwares.

I was in the same situation as you and I found it way easier to write a thin wrapper around my NDK code so I could compile/run it on my computer. In my case the NDK part was doing OpenGL rendering, so I just used SDL to "port" it. Then, just debug on your computer and you'll catch most of the bugs... of course not the Android/JNI specific ones ...
Junior Developer
Junior Developer
Posts: 19
Joined: Fri Mar 12, 2010 4:05 pm


Return to NDK Problems

Who is online

Users browsing this forum: No registered users and 2 guests