Harry Joy
Harry Joy

Reputation: 59680

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

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:-

Upvotes: 2

Views: 8305

Answers (4)

user1177473
user1177473

Reputation: 1

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

Upvotes: 0

kaushal
kaushal

Reputation: 11

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.

Upvotes: 1

Sdra
Sdra

Reputation: 2347

Simply:

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

Upvotes: 1

Julio Gorgé
Julio Gorgé

Reputation: 10106

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.

Upvotes: 1

Related Questions