0

我正在尝试在我的 android 应用程序中使用 .so 库( http://illiri.com/api.html )。我已经复制了 libs 文件夹中的 .so 文件(libs/armeabi、libs/armeabi-v7a、libs/mips、libs/x86),并将库加载为,

System.loadLibrary("crypto");
System.loadLibrary("ssl");
System.loadLibrary("sapi");

但是我在堆栈跟踪中遇到了这个错误。

    08-26 11:17:24.677: E/dalvikvm(25747): Could not find class 'com.illiri.sapi.SAPIConnection', referenced from method com.ey.illiritest.MainActivity.onCreate
    08-26 11:17:24.697: W/dalvikvm(25747): VFY: unable to resolve new-instance 474 (Lcom/illiri/sapi/SAPIConnection;) in Lcom/ey/illiritest/MainActivity;
    08-26 11:17:24.697: D/dalvikvm(25747): VFY: replacing opcode 0x22 at 0x000b
    08-26 11:17:24.697: D/dalvikvm(25747): VFY: dead code 0x000d-0030 in Lcom/ey/illiritest/MainActivity;.onCreate (Landroid/os/Bundle;)V
    08-26 11:17:24.697: I/dalvikvm(25747): Could not find method com.illiri.sapi.SAPIConnection.suspend, referenced from method com.ey.illiritest.MainActivity.onPause
    08-26 11:17:24.697: W/dalvikvm(25747): VFY: unable to resolve virtual method 3424: Lcom/illiri/sapi/SAPIConnection;.suspend ()V
    08-26 11:17:24.697: D/dalvikvm(25747): VFY: replacing opcode 0x6e at 0x0005
    08-26 11:17:24.697: D/dalvikvm(25747): VFY: dead code 0x0008-0008 in Lcom/ey/illiritest/MainActivity;.onPause ()V
    08-26 11:17:24.707: I/dalvikvm(25747): Could not find method com.illiri.sapi.SAPIConnection.resume, referenced from method com.ey.illiritest.MainActivity.onResume
    08-26 11:17:24.707: W/dalvikvm(25747): VFY: unable to resolve virtual method 3423: Lcom/illiri/sapi/SAPIConnection;.resume ()V
    08-26 11:17:24.707: D/dalvikvm(25747): VFY: replacing opcode 0x6e at 0x0005
    08-26 11:17:24.707: D/dalvikvm(25747): VFY: dead code 0x0008-0008 in Lcom/ey/illiritest/MainActivity;.onResume ()V
    08-26 11:17:24.707: D/dalvikvm(25747): Trying to load lib /mnt/asec/com.ey.illiritest-1/lib/libcrypto.so 0x2afcad60
    08-26 11:17:24.707: D/dalvikvm(25747): Added shared lib /mnt/asec/com.ey.illiritest-1/lib/libcrypto.so 0x2afcad60
    08-26 11:17:24.707: D/dalvikvm(25747): No JNI_OnLoad found in /mnt/asec/com.ey.illiritest-1/lib/libcrypto.so 0x2afcad60, skipping init
    08-26 11:17:24.707: D/dalvikvm(25747): Trying to load lib /mnt/asec/com.ey.illiritest-1/lib/libssl.so 0x2afcad60
    08-26 11:17:24.707: D/dalvikvm(25747): Added shared lib /mnt/asec/com.ey.illiritest-1/lib/libssl.so 0x2afcad60
    08-26 11:17:24.707: D/dalvikvm(25747): No JNI_OnLoad found in /mnt/asec/com.ey.illiritest-1/lib/libssl.so 0x2afcad60, skipping init
    08-26 11:17:24.707: D/dalvikvm(25747): Trying to load lib /mnt/asec/com.ey.illiritest-1/lib/libsapi.so 0x2afcad60
    08-26 11:17:24.827: W/dalvikvm(25747): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/ey/illiritest/MainActivity;
    08-26 11:17:24.837: W/dalvikvm(25747): Class init failed in newInstance call (Lcom/ey/illiritest/MainActivity;)
    08-26 11:17:24.837: D/AndroidRuntime(25747): Shutting down VM
    08-26 11:17:24.847: W/dalvikvm(25747): threadid=1: thread exiting with uncaught exception (group=0x2aacc560)
    08-26 11:17:24.847: E/AndroidRuntime(25747): Uncaught handler: thread main exiting due to uncaught exception
    08-26 11:17:24.937: W/System.err(25747): java.io.IOException: Permission denied
    08-26 11:17:24.937: E/AndroidRuntime(25747): FATAL EXCEPTION: main
    08-26 11:17:24.937: E/AndroidRuntime(25747): java.lang.ExceptionInInitializerError
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at java.lang.Class.newInstanceImpl(Native Method)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at java.lang.Class.newInstance(Class.java:1409)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.os.Handler.dispatchMessage(Handler.java:99)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.os.Looper.loop(Looper.java:130)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at android.app.ActivityThread.main(ActivityThread.java:3683)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at java.lang.reflect.Method.invokeNative(Native Method)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at java.lang.reflect.Method.invoke(Method.java:507)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at dalvik.system.NativeStart.main(Native Method)
    08-26 11:17:24.937: E/AndroidRuntime(25747): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]:  1376 cannot locate '__gnu_thumb1_case_uqi'...
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at java.lang.Runtime.loadLibrary(Runtime.java:434)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at java.lang.System.loadLibrary(System.java:554)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    at com.ey.illiritest.MainActivity.<clinit>(MainActivity.java:167)
    08-26 11:17:24.937: E/AndroidRuntime(25747):    ... 15 more
    08-26 11:17:24.967: W/System.err(25747): java.io.FileNotFoundException: /data/plog.log (Permission denied)
    08-26 11:17:27.797: I/Process(25747): Sending signal. PID: 25747 SIG: 9
    08-26 11:18:46.837: E/dalvikvm(25943): Could not find class 'com.illiri.sapi.SAPIConnection', referenced from method com.ey.illiritest.MainActivity.onCreate
    08-26 11:18:46.837: W/dalvikvm(25943): VFY: unable to resolve new-instance 474 (Lcom/illiri/sapi/SAPIConnection;) in Lcom/ey/illiritest/MainActivity;
    08-26 11:18:46.837: D/dalvikvm(25943): VFY: replacing opcode 0x22 at 0x001a
    08-26 11:18:46.837: D/dalvikvm(25943): VFY: dead code 0x001c-003f in Lcom/ey/illiritest/MainActivity;.onCreate (Landroid/os/Bundle;)V
    08-26 11:18:46.837: I/dalvikvm(25943): Could not find method com.illiri.sapi.SAPIConnection.suspend, referenced from method com.ey.illiritest.MainActivity.onPause
    08-26 11:18:46.837: W/dalvikvm(25943): VFY: unable to resolve virtual method 3424: Lcom/illiri/sapi/SAPIConnection;.suspend ()V
    08-26 11:18:46.837: D/dalvikvm(25943): VFY: replacing opcode 0x6e at 0x0005
    08-26 11:18:46.837: D/dalvikvm(25943): VFY: dead code 0x0008-0008 in Lcom/ey/illiritest/MainActivity;.onPause ()V
    08-26 11:18:46.847: I/dalvikvm(25943): Could not find method com.illiri.sapi.SAPIConnection.resume, referenced from method com.ey.illiritest.MainActivity.onResume
    08-26 11:18:46.847: W/dalvikvm(25943): VFY: unable to resolve virtual method 3423: Lcom/illiri/sapi/SAPIConnection;.resume ()V
    08-26 11:18:46.847: D/dalvikvm(25943): VFY: replacing opcode 0x6e at 0x0005
    08-26 11:18:46.847: D/dalvikvm(25943): VFY: dead code 0x0008-0008 in Lcom/ey/illiritest/MainActivity;.onResume ()V
    08-26 11:18:46.877: D/dalvikvm(25943): Trying to load lib /mnt/asec/com.ey.illiritest-1/lib/libcrypto.so 0x2afcb300
    08-26 11:18:46.877: D/dalvikvm(25943): Added shared lib /mnt/asec/com.ey.illiritest-1/lib/libcrypto.so 0x2afcb300
    08-26 11:18:46.877: D/dalvikvm(25943): No JNI_OnLoad found in /mnt/asec/com.ey.illiritest-1/lib/libcrypto.so 0x2afcb300, skipping init
    08-26 11:18:46.877: D/dalvikvm(25943): Trying to load lib /mnt/asec/com.ey.illiritest-1/lib/libssl.so 0x2afcb300
    08-26 11:18:46.877: D/dalvikvm(25943): Added shared lib /mnt/asec/com.ey.illiritest-1/lib/libssl.so 0x2afcb300
    08-26 11:18:46.877: D/dalvikvm(25943): No JNI_OnLoad found in /mnt/asec/com.ey.illiritest-1/lib/libssl.so 0x2afcb300, skipping init
    08-26 11:18:46.877: D/dalvikvm(25943): Trying to load lib /mnt/asec/com.ey.illiritest-1/lib/libsapi.so 0x2afcb300
    08-26 11:18:46.927: D/AndroidRuntime(25943): Shutting down VM
    08-26 11:18:46.927: W/dalvikvm(25943): threadid=1: thread exiting with uncaught exception (group=0x2aacc560)
    08-26 11:18:46.927: E/AndroidRuntime(25943): Uncaught handler: thread main exiting due to uncaught exception
    08-26 11:18:46.957: W/System.err(25943): java.io.IOException: Permission denied
    08-26 11:18:46.967: E/AndroidRuntime(25943): FATAL EXCEPTION: main
    08-26 11:18:46.967: E/AndroidRuntime(25943): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]:  1376 cannot locate '__gnu_thumb1_case_uqi'...
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at java.lang.Runtime.loadLibrary(Runtime.java:434)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at java.lang.System.loadLibrary(System.java:554)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at com.ey.illiritest.MainActivity.onCreate(MainActivity.java:36)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.os.Handler.dispatchMessage(Handler.java:99)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.os.Looper.loop(Looper.java:130)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at android.app.ActivityThread.main(ActivityThread.java:3683)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at java.lang.reflect.Method.invokeNative(Native Method)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at java.lang.reflect.Method.invoke(Method.java:507)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653)
    08-26 11:18:46.967: E/AndroidRuntime(25943):    at dalvik.system.NativeStart.main(Native Method)
    08-26 11:18:46.987: W/System.err(25943): java.io.FileNotFoundException: /data/plog.log (Permission denied)

我在互联网上搜索了很多,但仍然无法找到解决方案。请帮忙。

4

2 回答 2

0

AFAIK,每当我们使用 android ndk 的命令编译任何本机代码并生成 *.so 文件ndk-build时,它都是特定于特定工具链的。

现在,您在应用程序中下载和使用的库可能不是使用 Android ndk 支持的工具链构建的。这是我在应用程序中使用它时遇到类似错误的原因之一。

所以试试android系统支持的工具链生成的*.so文件。

于 2013-08-26T06:37:19.567 回答
0

这是一个工具链问题(请参阅https://dev.guardianproject.info/issues/229) - 强制 NDK 工具链到 4.4.3 似乎可以完成这项工作。

于 2013-08-30T20:59:23.560 回答