17 messages in com.googlegroups.android-internalsRe: Need little help for JNI| From | Sent On | Attachments |
|---|---|---|
| Diluka Moratuwage | 18 Feb 2008 23:08 | |
| Diluka Moratuwage | 20 Feb 2008 20:52 | |
| hackbod | 20 Feb 2008 22:21 | |
| Diluka Moratuwage | 20 Feb 2008 23:56 | |
| Diluka Moratuwage | 21 Feb 2008 09:51 | |
| Diluka Moratuwage | 22 Feb 2008 01:34 | |
| Diluka Moratuwage | 22 Feb 2008 03:17 | |
| Susmith M R | 24 Feb 2008 11:00 | |
| Diluka Moratuwage | 24 Feb 2008 18:49 | |
| Susmith M R | 28 Feb 2008 10:22 | |
| Diluka Moratuwage | 28 Feb 2008 10:49 | |
| Susmith M R | 02 Mar 2008 11:25 | |
| Diluka Moratuwage | 02 Mar 2008 20:16 | |
| Diluka Moratuwage | 02 Mar 2008 20:22 | |
| jitendra | 18 Mar 2008 02:23 | |
| sbVB | 19 Mar 2008 09:10 | |
| sbVB | 20 Mar 2008 17:07 |
| Subject: | Re: Need little help for JNI![]() |
|---|---|
| From: | jitendra (jcku...@gmail.com) |
| Date: | 03/18/2008 02:23:34 AM |
| List: | com.googlegroups.android-internals |
Hi,
I have created a libhello.so with one native unction to print a hello world message. I am loading this library from my java code and i see following logs in my logcat window:
INFO/dalvikvm(934): Added shared lib /system/lib/libhello.so 0x400692f0 DEBUG/dalvikvm(934): +++ not scanning '/system/lib/libwebcore.so' for 'hello' (wrong CL) DEBUG/dalvikvm(934): +++ not scanning '/system/lib/libmedia_jni.so' for 'hello' (wrong CL)
Does anybody why exactly this error is coming ?
Thanks, Jitendra
On Feb 21, 12:57 pm, Diluka Moratuwage <dil...@wso2.com> wrote:
Hi Hackbod, Thanks for the answer. When I do load only one library, when I use logcat, I get the following output. Do you see something suspicious in there if you are familiar with that. This is a simple native function, which only return a string. It doesn't load another library. I'm suspicious about JNI_OnLoad not found thing. Do you have some idea about that.
Thanks, Diluka.
I/ActivityManager( 467): Starting activity: Intent { action=android.intent.action.MAIN launchFlags=4 comp={com.android.wso2/com.android.wso2.svc_client} } I/ActivityManager( 467): Starting app process com.android.wso2 to host activity {com.android.wso2/com.android.wso2.svc_client}: pid=798 D/jdwp ( 798): JDWP listening on port 8004 I/ActivityThread( 798): Loading code package com.android.wso2 (in com.android.wso2) D/ActivityThread( 798): Performing launch of ActivityRecord{400cc9a0 {com.android.wso2/com.android.wso2.svc_client}} I/ActivityManager( 467): Displayed activity {com.android.wso2/com.android.wso2.svc_client}: 429 ms I/ActivityManager( 467): Done launching {com.android.wso2/com.android.wso2.svc_client}: 432 ms D/ActivityManager( 467): Stopping: HistoryRecord{40174cb0 {com.google.android.home/com.google.android.home.AllApps}} D/dalvikvm( 798): LOADING path /system/lib/libloader.so 0x4005c9e8 I/dalvikvm( 798): Added shared lib /system/lib/libloader.so 0x4005c9e8 I/dalvikvm( 798): No JNI_OnLoad found in /system/lib/libloader.so 0x4005c9e8 D/dalvikvm( 798): +++ not scanning '/system/lib/libwebcore.so' for 'invoke' (wrong CL) D/dalvikvm( 798): +++ not scanning '/system/lib/libmedia_jni.so' for 'invoke' (wrong CL)
hackbod wrote:
I don't know if this is the cause of your problem, but the android system already has a library called libutil.
On Feb 20, 8:52 pm, Diluka Moratuwage <dil...@wso2.com> wrote:
Does anybody have some idea of this problem ? My problem is whenJNI loads one library and it uses another one, the second library which is used internally by the first library is not loaded and linked properly.
Thanks, Diluka.
Diluka Moratuwage wrote:
Hi all, I have a new problem in Android, hope some one can give some light on this; in one of my applications I useJNI. My story is follows; I have two libraries called libloader.so and libutil.so. In my java application I do a System.loadLibrary("loader"). And this works fine and I can call a native method in loader library successfully. Then I need to call a function in the util library from loader library. But when I do that, it gives a unsatisfied linker exception.
Then I tried to load the util library manually to test whether java can find it, by calling System.loadLibrary("util"). But this fails giving an unsatisfied linker error. I have used the symbolic links and so on accurately. I'm 100% sure that java can find the library. (I use the same way as I do to the loader library here)
What I have a suspect on the headers of the libraries. I used the readelf -l command and what I found was as follows; **When I did it on loader library the header information was;
root@diluka-laptop:/home/diluka/TestPrograms/JNI-svc-client/Android/svc_client/src/com/android/wso2/loader-testing/deploy/lib# readelf -l libloader.so.0.0.0
Elf file type is DYN (Shared object file) Entry point 0x23c There are 3 program headers, starting at offset 52
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x00000000 0x00000000 0x002f0 0x002f0 RWE 0x8000 DYNAMIC 0x000284 0x00000284 0x00000284 0x00060 0x00060 RW 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
Section to Segment mapping: Segment Sections... 00 .hash .dynsym .dynstr .text .rodata .dynamic .got 01 .dynamic 02
** But when I did the same thing for the util library I got the following;
root@diluka-laptop:/home/diluka/projects/EmbeddedAxis2c/c/deploy/lib# readelf -l libutil.so.0.0.0
Elf file type is DYN (Shared object file) Entry point 0x6cb4 There are 3 program headers, starting at offset 52
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x00000000 0x00000000 0x16f84 0x19b18 RWE 0x8000 DYNAMIC 0x0169fc 0x000169fc 0x000169fc 0x00098 0x00098 RW 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
Section to Segment mapping: Segment Sections... 00 .hash .dynsym .dynstr .rel.dyn .rel.plt .plt .text .rodata .data.rel.ro .dynamic .got .data .bss 01 .dynamic 02
I think any library with simple header info like above get loaded but the libraries like util didn't get loaded for me. Anybody have some idea on this ? Please put me a small info on this if you know something about this.
Thanks,




