could not load library quot;libdl.so.2quot;(无法加载库“libdl.so.2)
问题描述
I have been trying to use linux compiled prebuilt shared library with my android jni application, but when i try to run the application it gives following error:
04-16 19:09:13.633: E/dalvikvm(11810): dlopen("/data/app-lib/com.lXXXX.XXXX.connect-2/libXXX_embedded_shared.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1636): could not load library "libdl.so.2" needed by "libXXX_embedded_shared.so"; caused by load_library(linker.cpp:746): library "libdl.so.2" not found
i could not find libdl.so.2 in android/system/lib but there is a library libdl.so which i tried to load but it still did not resolve the dependency.
Can you please point me what i am missing here?
You cannot do this.
Android and a normal linux have vastly different userspaces, in particular they use entirely different C libraries and associated incompatible dynamic linkers.
The very desire for a versioned library name (the .so.2 - something Android doesn't currently do) is indicative that this library was not build for Android.
You need to rebuild all your libraries using the android ndk either by creating and Android.mk and similar files to drive the normal ndk build system, or by using the ndk utility for generating a "stand alone toolchain" and pointing your project's build system at the resulting android-targeted gcc, ld, etc.
Some people have managed to use normal linux userspace components on rooted devices by putting a whole minimal install of debian-arm or similar in a chroot, but that requires root to set up and would not be linkable from an application process by jni anyway. Your application process is already deeply tied to Android's C library so you can't really substitute another.
这篇关于无法加载库“libdl.so.2"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法加载库“libdl.so.2"
基础教程推荐
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01