System.loadLibrary("Jpcap") failes in Android with UnsatisfiedLinkError Inbox X

889 views
Skip to first unread message

Viju

unread,
Jun 1, 2011, 6:08:40 AM6/1/11
to android-ndk
Can anyone please tell me how can I compile the third party opensource
library using NDK.

In my application am using an opensource library called Jpcap, which
provide RAR and .so files.
I' just need to call these APIs from my application. But in those APIs
they are trying to load a library Jpcap
i.e.
System.loadLibrary("jpcap").

at this place am getting a linking error :

java.lang.UnsatisfiedLinkError: Cannot load library:
link_image[1962]: 32 could not load needed library 'libpcap.so.0.9'
for 'libjpcap.so' (load_library[1104]: Library 'libpcap.so.0.9' not
found)



Please help me to resolve this issue.


thanks & regards,
Vijay

Riasat Abir

unread,
Jun 2, 2011, 1:13:13 AM6/2/11
to andro...@googlegroups.com
Did you compile that library?
Was the .so file compiled by ndk?
If you have source code (as it is open source) try to compile it in Android.


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
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.




--

HimHim

fadden

unread,
Jun 2, 2011, 4:55:40 PM6/2/11
to android-ndk
On Jun 1, 3:08 am, Viju <mail2vija...@gmail.com> wrote:
> System.loadLibrary("jpcap").
>
> at this place am getting a linking error :
>
>  java.lang.UnsatisfiedLinkError: Cannot load library:
> link_image[1962]:    32 could not load needed library 'libpcap.so.0.9'
> for 'libjpcap.so' (load_library[1104]: Library 'libpcap.so.0.9' not
> found)

Where does that .so live on the device? Is it in the native libs
directory of your app?

Try System.load() instead, giving a full path to the library. (Don't
actually ship your app with a hard-coded full path -- do this to see
if the problem is that the library isn't where the system is trying to
find it.)

David Turner

unread,
Jun 2, 2011, 7:20:27 PM6/2/11
to andro...@googlegroups.com
On Wed, Jun 1, 2011 at 12:08 PM, Viju <mail2v...@gmail.com> wrote:

 java.lang.UnsatisfiedLinkError: Cannot load library:
link_image[1962]:    32 could not load needed library 'libpcap.so.0.9'
for 'libjpcap.so' (load_library[1104]: Library 'libpcap.so.0.9' not
found)


The error is that your libjpcap.so was built with a dependency on another library named libpcap.so.0.9
Since this is a versioned library name, and that we do not support these in Android (either the platform or the NDK), I suspect that you're trying to reuse a binary shared library that was built for another system. That simply won't work.

You need to rebuild libjpcap.so and libpcap.so. By the way, if your libpcap.so corresponds to this open-source project (http://sourceforge.net/projects/libpcap/), then this won't work in Android unless you are root (normal applications don't have access to raw sockets).
 

Please help me to resolve this issue.


thanks & regards,
Vijay
Reply all
Reply to author
Forward
0 new messages