当使用OpenSSL交叉编译到Android时,无法加载本机库libmain.so

时间:2017-02-16 17:06:13

标签: android android-ndk openssl rust rust-cargo

我在使用cargo-apk的OpenSSL时遇到了一些麻烦。

我已经提供 libssl.so libcrypto.so ,并且 openssl 包含到android-ndk并使用{{1使用自定义构建脚本:

PKG_CONFIG_ALLOW_CROSS=1 cargo-apk

编译成功,但是当我运行我的应用程序时,我使用fn main () { println!("cargo:rustc-link-lib=crypto"); println!("cargo:rustc-link-lib=ssl"); } 获取以下日志,并且应用程序崩溃。

adb logcat

这是 main.rs

I/Timeline( 1715): Timeline: Activity_launch_request id:rust.fantafs time:48384944
V/ApplicationPolicy( 1184): isApplicationStateBlocked userId 0 pkgname rust.fantafs
W/ActivityManager( 1184): NORMAL SET : srcAppInfo.processName = com.sec.android.app.launcher, destAppInfo.processName = rust.fantafs
V/ApplicationPolicy( 1184): isApplicationStateBlocked userId 0 pkgname rust.fantafs
I/ActivityManager( 1184): Start proc rust.fantafs for activity rust.fantafs/.MainActivity: pid=1008 uid=10228 gids={50228, 9997, 3003, 1028, 1015} abi=armeabi
E/AndroidRuntime( 1008): Process: rust.fantafs, PID: 1008
E/AndroidRuntime( 1008): java.lang.RuntimeException: Unable to start activity ComponentInfo{rust.fantafs/rust.fantafs.MainActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app/rust.fantafs-1/lib/arm/libmain.so
E/AndroidRuntime( 1008): Caused by: java.lang.IllegalArgumentException: Unable to load native library: /data/app/rust.fantafs-1/lib/arm/libmain.so
V/ApplicationPolicy( 1184): isApplicationStateBlocked userId 0 pkgname rust.fantafs
W/ActivityManager( 1184):   Force finishing activity rust.fantafs/.MainActivity
V/ApplicationPolicy( 1184): isApplicationStateBlocked userId 0 pkgname rust.fantafs
W/ActivityManager( 1184): Activity pause timeout for ActivityRecord{1a641bc7 u0 rust.fantafs/.MainActivity t150 f}
I/ActivityManager( 1184): Process rust.fantafs (pid 1008)(adj 11) has died(77,169)

0 个答案:

没有答案