I did everything “right”:
-
Created my JNI module with
LOCAL_MODULE := libfooin jni/Android.mk -
Called
System.loadlibrary("libfoo") -
Declared the correct signature for the method and even double-checked it with
javah
but still got an UnsatisfiedLinkError exception with the message:
Couldn’t load libfoo: findLibrary returned null
Apparently the loadLibrary method prepends “lib” automatically so the proper way to load a filename such as “libfoo.so” is by calling
System.loadLibrary("foo").I learned this the hard way, so you wouldn’t have to.