开发者

how to load .so file that are not in System/lib folder in android?

开发者 https://www.devze.com 2023-02-09 04:26 出处:网络
I have a so file named libJSA.so in memory card in android and wanna load it in my application. How can i load this file using System.loadLibrary(\"libname\"); ?

I have a so file named libJSA.so in memory card in android and wanna load it in my application.

How can i load this file using System.loadLibrary("libname"); ?

Things i have tried:-

  • t开发者_开发知识库ry to copy it to /system/lib. ---- Not worked
  • System.loadlibrary("/mnt/sdcard/folder/libJSA.so"); -------- Not worked


AFAIK, unless it's a system library or you are on a rooted device, you can't load any libraries that are outside your signed APK bundle, meaning what you want to do can't be done.


Simply:

System.load("/mnt/sdcard/folder/libJSA.so");


System.loadlibrary("/mnt/sdcard/folder/libJSA.so"); // Not working

try:

System.loadLibrary ("JSA.so");

not (java is ase sensitive):

System.loadlibrary("JSA.so")

or instead try

Static{
    System.load("/sdcard/folder/libJSA.so");
}

put this inside the class and outside onCreate.


Try removing "lib" prefix.
If your library name is "libJSA.so", try to use System.loadLibrary ("JSA");

0

精彩评论

暂无评论...
验证码 换一张
取 消