In a recent JNI project, the so library was given a layer of JNI encapsulation, equal to the method of invoking a third-party library in the JNI C + + code, and the entire project ran on Android.
The third-party library that Libaa.so uses for its own JNI generation is libbb.so.
So far, the problem encountered is that libbb a variety of can not find. Where's the LIBBB library?
E/androidruntime (11626): caused by:java.lang.UnsatisfiedLinkError:
Cannot load Library:soinfo_link_image (linker.cpp:1640):
Could not load library "libbb.so" needed by "libaa.so";
Caused by Load_library (linker.cpp:750): library ' libbb.so ' not found
The above error occurs in the run phase, in fact, the compilation phase also occurred in the problem of finding a third party, the performance is the library implementation of the method undefined.
Resolved in two ways
1, the compilation phase can not find the library, need to modify the Mk file.
1.libbb.so put in the Jni/prebuilt folder (own new), while the android.mk copy to prebuilt.
2.Libbb.so's MK is as follows:
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = bblocal_src_files: = Libbb.soinclude $ (prebuilt_shared _library)
3.libaa.so's MK file needs to be introduced in the above Mk.
Local_path: = $ (call My-dir) include $ (clear_vars) local_module : = aalocal_src_files: = aa.cpplocal_ldlibs: =- Lloglocal_shared_libraries: = Bbinclude $ (build_shared_library) include $ (local_path)/prebuilt/android.mk
This allows you to connect to a third-party library during the compile phase.
2. Library not found at run stage
The library is not found in the run phase is the android thing. Later discovered is the order of the load library (a silent, broken sequence. )。
static {system.loadlibrary ("BB"); System.loadlibrary ("AA"); }
Load the third-party library first, and then load your own library, because the AA library to use the BB library method, is dependent on the BB Library, so the first load.
This will also find the library at run time.
Android JNI cannot find a solution for a third-party library cannot load library