Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

android - Unable to dlopen(libsomething.so) Cannot load library: link_image[1995]: failed to link libsomething.so

I am writing an android project which has Native layer helping the java layer, and am stuck at a place where when i try to do a System.loadLibrary, it is throwing error that it is not able to link it.

I am using Target specific NDK to build the native layer, and then using ant to compile and create the apk.

On running on the device i get the following error.

Unable to dlopen(libsomething.so) Cannot load library: link_image[1995]: failed to link libsomething.so

The library get bundled into the apk, and is unpacked properly. If i try to remove the library manually and then run it, it then actually throws that library not found. So it is able to find the library, but it throws this error, and i am not able to find out why this error is coming.

Please help me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First find the location of the .so file. and then can try:

Following example assumes the location of shared library as: /data/data/my.package/lib/libmysharedlibrary.so

try {
    //System.loadLibrary("mysharedlibrary");
    System.load("/data/data/my.package/lib/libmysharedlibrary.so");
} catch (UnsatisfiedLinkError use) {
    Log.e("JNI", "WARNING: Could not load libmysharedlibrary.so");
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...