简体   繁体   中英

In Android ,How to load other shared library in jni_onLoad method?

In my android project , there are two shared libraries a.so and b.so,now,I want to load b.so in method of jni_onload in a.so, i have written dlopen, dlsym and could find their returns, but it also needs a classLoader, what should i do next,Can you give me some advices? thank you!

You can use dlopen then search for JNI_OnLoad in the other library with dlsym and run it if this other library registers all natives in JNI_OnLoad ( which is recommended ). If you need to use lazy resolving, you need to call System.loadLibrary() from JNI_OnLoad instead of dlopen .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM