我试图通过loadLibrary调用在我的
Android应用程序中加载两个共享库:
System.loadLibrary("mywrapper"); System.loadLibrary("crypto");
我一直在追赶’UnsatisfiedLinkError’.这是错误的更详细版本.
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1969]: 130 could not load needed library 'libcrypto.so.1.0.0' for 'libmywrapper.so' (load_library[1111]: Library 'libcrypto.so.1.0.0' not found)
有任何想法吗?
花了一些时间后,我发现Android不支持版本化库.有谁遇到过同样的问题?
解决方法
我在为Android构建libwebsockets时遇到了同样的问题,需要与OpenSSL链接.我以libssl.so为例.您应该对相关的.so文件执行相同的操作.
Before: huiying@huiying-PORTEGE-R835:~$objdump -p libssl.so | grep so libssl.so: file format elf32-little NEEDED libcrypto.so.1.0.0 NEEDED libdl.so NEEDED libc.so SONAME libssl.so.1.0.0 After huiying@huiying-PORTEGE-R835:~$rpl -R -e .so.1.0.0 "_1_0_0.so" libssl.so Replacing ".so.1.0.0" with "_1_0_0.so" (case sensitive) (partial words matched) . A Total of 2 matches replaced in 1 file searched. huiying@huiying-PORTEGE-R835:~$objdump -p libssl.so | grep so libssl.so: file format elf32-little NEEDED libcrypto_1_0_0.so NEEDED libdl.so NEEDED libc.so SONAME libssl_1_0_0.so And don't forget to change file name "libssl.so" to "libssl_1_0_0.so".
黑客工作.我已经运行Android应用来证明这一点.在http://computervisionandjava.blogspot.com/2015/05/trouble-with-versioned-shared-libraries.html看到我的咆哮.