• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Including Prebuilt Shared Library in NDK

t.elimpus

Lurker
Hey guys, i've recently built the Libusb library using ndk-build to produce the .so. Now i need to be able the call functions for my app. Im trying to make a .c file that will call Libusb, and use the jni/ndk to link this to eclipse. For example:
Code:
JNIEXPORT jint JNICALL Java_com_usb_NativeLib_init
  (JNIEnv *env , jobject obj){
    int i = libusb_init(NULL);
    return i;
}
The problem is, that it will compile fine with ndk-build - giving me a libs folder with libusb.so and libmy_lib.so, but when i run it from eclipse, LogCat gives me the error - UnsatisfiedLinkError : Library my_lib not found.

Im sorry for the awful explanation, but if you understood and could help, that would be great! Thanks, T.
 
I think you need to build jni code along with the Libusb library refer two-lib example for this,

Or you can use PREBUILT_SHARED_LIBRARY option, using this you can use pre-built Libusb library.
 
Back
Top Bottom