无法执行dlopen(libsomething.so)无法加载库:link_image [1995]:无法连接libsomething.so [英] Unable to dlopen(libsomething.so) Cannot load library: link_image[1995]: failed to link libsomething.so

查看:188
本文介绍了无法执行dlopen(libsomething.so)无法加载库:link_image [1995]:无法连接libsomething.so的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个Android项目,有原生层帮助了Java层,和我停留在一个地方,当我尝试做的System.loadLibrary,它抛出的错误,这是不能够联系起来。

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.

我使用的目标具体NDK构建本地图层,然后使用Ant编译和创建APK。

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.

无法执行dlopen(libsomething.so)无法加载库:link_image [1995]:无法连接libsomething.so

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

该库获得捆绑到apk文件,并正确解压。如果我尝试手动删除库中,然后运行它,然后它居然抛出了找不到库。因此,它是能够找到库,但它抛出这个错误,我不能够找出为什么这个错误是来了。

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.

请帮我。

推荐答案

首先找到.so文件的位置。然后可以试试:

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

下面的例子假定共享库的位置: /data/data/my.package/lib/libmysharedlibrary.so

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");
}

这篇关于无法执行dlopen(libsomething.so)无法加载库:link_image [1995]:无法连接libsomething.so的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆