Search code examples
androidjava-native-interface

jni loadlibrary, findLibrary returns null


I have already checked the existing questions on SO. I am a first time asker but always look for my problems here and usually find the solutions to them. This time I couldn't.

I'm trying to use echoprint's audio fingerprinting api and I have implemented the code successfully. But when I execute it I get this error:

        07-28 19:50:05.910: E/AndroidRuntime(23067): FATAL EXCEPTION: Thread-15102
        07-28 19:50:05.910: E/AndroidRuntime(23067): java.lang.UnsatisfiedLinkError: 
Couldn't load echoprint-jni from loader    dalvik.system.PathClassLoader[dexPath=/data/app/com.example.realapptest1-2.apk,
    libraryPath=/data/app-lib/com.example.realapptest1-2]: findLibrary returned null

I do not really know how to solve this issue. The api folder comes with a "jni" folder if that helps. But I have literally no idea what else I am supposed to do.

As can be assumed I am using the Eclipse IDE. There are no errors in my application. I have proof checked it, there are no problems in my code.

Thank you.


Solution

  • From documentation: link

    UnsatisfiedLinkError: Thrown when an attempt is made to invoke a native for which an implementation could not be found.
    

    Your app tries to call a native library and does not find it. Make sure that the native library is build and that you call

    System.loadLibrary("your-library-name");
    

    before you use it.

    You can read more about Android Ndk here.

    Also, here's a good tutorial that will make the Ndk easier to understand: link