Skip to content Skip to sidebar Skip to footer

System.loadlibrary() Error

I successfully cross-compiled a c++ library with the android ndk-Standalone toolchain then, i created a new android application project into Eclipse and when i put mylib.so into th

Solution 1:

People mostly forgot cut "lib" prefix form library name. So if you have "libusb.so" your code must be System.loadLibrary("usb")...

Solution 2:

I recently encountered the same error. After trying out dozens of suggestions from SO, I finally figured out that the error was in my native code. even though android ndk had compiled it without any issues / warnings.

Try writing a simple main function to test your native code and compile with g++/gcc (or something similar) to check for errors.

I know its too late for the asker, but hope someone else finds this useful.

Solution 3:

If you have your compiled native library (the .so-file) in your lib/-directory, you can refer to it without using the full path:

static{
  System.load("mylib");
}

As shown in the tutorial.


Check to see if you set the right package in your Header-file: How to resolve the java.lang.UnsatisfiedLinkError in NDK in Android?

Solution 4:

try {
       System.load("/data/data/<package name>/lib/libsample-jni.so");
    } catch (UnsatisfiedLinkError e) {
       System.loadLibrary("<sample-jni>"); //remove lib and .so from name
}

this will help you, Pls. check.

Solution 5:

Please specify your .so file like as follow.

static {

     System.loadLibrary("mylib");

}

Hope this will help you.

Post a Comment for "System.loadlibrary() Error"