opendl 在 android 的 alljoynlib 中失败

opendl failed in alljoynlib in android

我的项目中有一个 alljoyn 库,用于为投票应用程序配对 android 设备。在旧设备中,应用 运行 正常,但在新设备中,它在开始 运行.

时停止

这是错误,我得到:

Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libcrypto.so" not found
                      at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
                      at java.lang.System.loadLibrary(System.java:1657)
                      at com.example.nima.voting.alljoyn.peergroupmanager.PeerGroupManager.<clinit>(PeerGroupManager.java:60)

注意:我不是 Android 开发人员。

就是说,我发现 this Whosebug question,它提到了与您描述的类似的行为:

The master Android process is zygote. Its like init in Linux. Zygote loads OpenSSL when its start, and it loads version 0.9.8. If you link against OpenSSL 1.0.1, then you will get mysterious runtime crashes. The crashes are due to the Android loader using the 0.9.8 version of the library (already mapped from Zygote), and not your version of OpenSSL.

You can use a shared object, but your shared object must be a wrapper around the static version of libssl and libcrypto.

您提到该应用程序在旧设备上可以正常加载,但在新设备上会崩溃。如果新设备 link 针对 OpenSSL v1.0.1 而旧设备针对 v0.9.8,那么这可能是问题的根本原因。

解决方案似乎是针对 libcrypto(显然也是 libssl)的静态库进行编译,或者在构建之后重命名这些依赖项,然后将它们复制到您的 precompiled 目录(如果我正确解释了 link 中的答案):

The reason is that the system comes with its own (probably different) version of these shared libraries, and the loader will use /system/lib/libssl.so and /system/lib/libcrypto.so instead of your private copies.