libxml2 链接问题
我正在运行一个 Android 项目,它缺少我添加的库,但没有 libxml2 的 jar,我不断收到此链接错误:
Originating from System.loadLibrary("xml2");
07-06 15:46:54.196:错误/AndroidRuntime(322):引起:java.lang.UnsatisfiedLinkError:找不到库xml2 07-06 15:46:54.196:错误/AndroidRuntime(322):在java.lang.Runtime.loadLibrary(Runtime.java:461) 07-06 15:46:54.196:错误/AndroidRuntime(322):在java.lang.System.loadLibrary(System.java:557) 07-06 15:46:54.196: ERROR/AndroidRuntime(322): at com.wiyun.engine.WiEngineDemos.(WiEngineDemos.java:49)
我需要将 .so 添加到我的 Android 项目配置中吗?如何?谢谢。
I am running an Android project, it had missing libraries that I added, but there is no jar for libxml2, I keep getting this linking error:
Originating from System.loadLibrary("xml2");
07-06 15:46:54.196: ERROR/AndroidRuntime(322): Caused by: java.lang.UnsatisfiedLinkError: Library xml2 not found
07-06 15:46:54.196: ERROR/AndroidRuntime(322): at java.lang.Runtime.loadLibrary(Runtime.java:461)
07-06 15:46:54.196: ERROR/AndroidRuntime(322): at java.lang.System.loadLibrary(System.java:557)
07-06 15:46:54.196: ERROR/AndroidRuntime(322): at com.wiyun.engine.WiEngineDemos.(WiEngineDemos.java:49)
Do i need to add .so to my Android project configuration? How? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
libxml2 是一个 C 库,而不是 java 库,除非您找到了已移植到 java 的版本。你需要编译它,然后使用Android的 NDK 来访问它,或者你需要尝试找到一个java端口。
libxml2 is a C library, not a java library unless you have found a version that has been ported to java. You need to compile it and then use Android's NDK to access it or you need to try and find a java port.
在我看来,根本找不到您的库。您确定 libxml2.so 包含在您的 APK 中并复制到 /data/data/your.package.name/lib/ 吗?
对于要包含在 APK 中的 .so,它通常需要位于 obj/local/armeabi 下(如果您的项目下有 jni 文件夹并使用 Android.mk / ndk-build 系统,它将自动“安装”)这里)
It looks to me that your library is simply not found. Are you sure libxml2.so is included in your APK and being copied to /data/data/your.package.name/lib/?
For a .so to be included in your APK it generally needs to be under obj/local/armeabi (If you have a jni folder under your project and using the Android.mk / ndk-build system, it will automatically be 'installed' here)
这似乎是 Eclipse 的问题...如果有人遇到同样的问题,他们只需重新启动 Eclipse,并检查所有 NDK 配置是否已正确设置,例如名称匹配等...
It appears to have been an issue with Eclipse... If anyone has the same issue they should simply restart Eclipse, and check that all NDK configurations are properlly set, like name matching, etc...