debugging a jni library

475 views
Skip to first unread message

bleubleu

unread,
Jul 31, 2012, 8:28:40 AM7/31/12
to andro...@googlegroups.com
Hello,

I am trying to debug a application that uses jni, but I encounter problems for 'complex' projects.

For my test, I begun with the sample gl2jni included in the ndk.
It works well, and I can attach gdb to it. When running ndk-gdb:
Found device gdbserver: /data/data/com.android.gl2jni/lib/gdbserver

But, if i modify this project to a library, and I create another project application that will use this library,
everything works fine (compilation, execution),
but if i try to execute ndk-gdb in the library directory, i get this:
ERROR: Non-debuggable application installed on the target device.

Does anybody can help ?

Baodong Chen

unread,
Jul 31, 2012, 8:57:59 AM7/31/12
to andro...@googlegroups.com
have you tried to set debugable=true in yor AndroidManifest.xml?

>
> Does anybody can help ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "android-ndk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/android-ndk/-/aoV5Q7b9-8YJ.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to
> android-ndk...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/android-ndk?hl=en.

bleubleu

unread,
Jul 31, 2012, 9:02:01 AM7/31/12
to andro...@googlegroups.com
yes, on both projects.

On Tuesday, July 31, 2012 2:57:59 PM UTC+2, Baodong Chen wrote:
On Tue, Jul 31, 2012 at 8:28 PM, bleubleu  wrote:
> Hello,
>
> I am trying to debug a application that uses jni, but I encounter problems
> for 'complex' projects.
>
> For my test, I begun with the sample gl2jni included in the ndk.
> It works well, and I can attach gdb to it. When running ndk-gdb:
> Found device gdbserver: /data/data/com.android.gl2jni/lib/gdbserver
>
> But, if i modify this project to a library, and I create another project
> application that will use this library,
> everything works fine (compilation, execution),
> but if i try to execute ndk-gdb in the library directory, i get this:
> ERROR: Non-debuggable application installed on the target device.
have you tried to set debugable=true in yor AndroidManifest.xml?

>
> Does anybody can help ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "android-ndk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/android-ndk/-/aoV5Q7b9-8YJ.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to
> android-ndk+unsubscribe@googlegroups.com.

Fabien R

unread,
Aug 1, 2012, 4:20:25 AM8/1/12
to andro...@googlegroups.com
On 31/07/2012 15:02, bleubleu wrote:
> yes, on both projects.
>
> On Tuesday, July 31, 2012 2:57:59 PM UTC+2, Baodong Chen wrote:
>
>> On Tue, Jul 31, 2012 at 8:28 PM, bleubleu wrote:
>>
>>> Hello,
>>>
>>> I am trying to debug a application that uses jni, but I encounter
>>>
>> problems
>>
>>> for 'complex' projects.
>>>
>>> For my test, I begun with the sample gl2jni included in the ndk.
>>> It works well, and I can attach gdb to it. When running ndk-gdb:
>>> Found device gdbserver: /data/data/com.android.gl2jni/lib/gdbserver
It's obvious for you but what is your environment: OS, adt, sdk,ndk ?
>>>
>>>
>>> But, if i modify this project to a library, and I create another project
>>> application that will use this library,
>>> everything works fine (compilation, execution),
>>> but if i try to execute ndk-gdb in the library directory, i get this:
>>> ERROR: Non-debuggable application installed on the target device.
>>>
what command line did you use ?
Do you use eclipse ?
>> have you tried to set debugable=true in yor AndroidManifest.xml?
>>
Maybe your problem is related to this:
http://stackoverflow.com/questions/8266852/not-able-to-attach-the-ndk-gdb-to-the-android-application

bleubleu

unread,
Aug 1, 2012, 5:03:04 AM8/1/12
to andro...@googlegroups.com
Ok, I found the problem.
It is impossible to debug a library project.
If I put my "main" in the java library project that contains the jni code,
I am able to debug.

Cyril CHAMPIER

unread,
Aug 29, 2012, 11:23:10 AM8/29/12
to andro...@googlegroups.com
Hi,

My problems comes from my solution hierarchy:
I launched java project A,
that depends on java project B,
that includes a c jni C.

Debug mode works only for a java project that directly includes a c jni.

If you are already in that mode, I cannot help you :(


On Wednesday, August 29, 2012 12:46:20 PM UTC+2, Yotam Michael wrote:
Hello,

I am facing the same problem
ndk-build NDK_LOG=1 -B give:
...
Gdbserver      : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
Gdbsetup       : libs/armeabi/gdb.setup

ndk-gdb   --verbose give:
Found debuggable flag: true
ERROR: Non-debuggable application installed on the target device.
       Please re-install the debuggable version!

I do not understand your solution, what exactly did you do?
My Project has no library projects attached to it.
Should I move the jni folder?
Should the C code be inserted directly into the java file?

Help would be very much appreciated.
Yotam

Swetha Setty

unread,
Aug 30, 2012, 5:26:56 AM8/30/12
to andro...@googlegroups.com
hi,
 
Have you set the the debugging mode for ndk( NDK_DEBUG=1) in your ndk build configurations?
Either you can do that or while building bdk, you could use ndk-build NDK_DEBUG=1
 
-Swetha

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/_6iAgcU3FrIJ.

To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.

ost12666

unread,
Aug 30, 2012, 5:21:46 PM8/30/12
to andro...@googlegroups.com
You can also put just the Application.mk in the java project to be able to debug.

Maybe it worth also trying the new NDK plugin and see if something improved:



On Wednesday, August 1, 2012 12:03:04 PM UTC+3, Cyril CHAMPIER wrote:
Reply all
Reply to author
Forward
0 new messages