Android的JNI无法加载依赖库

时间:2015-05-13 07:05:18

标签: android java-native-interface

我的Android应用程序使用JNI来调用C ++库。 C ++ lib已成功构建,但在虚拟设备中运行时,应用程序崩溃并出现以下错误:05-13 03:37:19.417: E/art(2280): dlopen("/data/app/com.sample.operator/lib/x86/libAndroidJNI.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "_ZN7android16ScreenshotClient6updateERKNS_2spINS_7IBinderEEE" referenced by "libAndroidJNI.so"... 05-13 03:37:19.418: D/AndroidRuntime(2280): Shutting down VM 05-13 03:37:19.418: E/AndroidRuntime(2280): FATAL EXCEPTION: main 05-13 03:37:19.418: E/AndroidRuntime(2280): Process: com.example.operator, PID: 2280 05-13 03:37:19.418: E/AndroidRuntime(2280): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android16ScreenshotClient6updateERKNS_2spINS_7IBinderEEE" referenced by "libAndroidJNI.so"... 05-13 03:37:19.418: E/AndroidRuntime(2280): at java.lang.Runtime.loadLibrary(Runtime.java:371) 05-13 03:37:19.418: E/AndroidRuntime(2280): at java.lang.System.loadLibrary(System.java:988) 05-13 03:37:19.418: E/AndroidRuntime(2280): at ... 05-13 03:37:19.418: E/AndroidRuntime(2280): at java.lang.reflect.Constructor.newInstance(Native Method) 05-13 03:37:19.418: E/AndroidRuntime(2280): at java.lang.Class.newInstance(Class.java:1606) 05-13 03:37:19.418: E/AndroidRuntime(2280): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2743) 05-13 03:37:19.418: E/AndroidRuntime(2280): at android.app.ActivityThread.access$1800(ActivityThread.java:151) 05-13 03:37:19.418: E/AndroidRuntime(2280): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1386) 05-13 03:37:19.418: E/AndroidRuntime(2280): at android.os.Handler.dispatchMessage(Handler.java:102) 05-13 03:37:19.418: E/AndroidRuntime(2280): at android.os.Looper.loop(Looper.java:135) 05-13 03:37:19.418: E/AndroidRuntime(2280): at android.app.ActivityThread.main(ActivityThread.java:5254) 05-13 03:37:19.418: E/AndroidRuntime(2280): at java.lang.reflect.Method.invoke(Native Method) 05-13 03:37:19.418: E/AndroidRuntime(2280): at java.lang.reflect.Method.invoke(Method.java:372) 05-13 03:37:19.418: E/AndroidRuntime(2280): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 05-13 03:37:19.418: E/AndroidRuntime(2280): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

这里发生了什么?我的开发环境是Windows 64位& eclipse Luna。

更新

当应用程序在Genymotion下运行时,这是崩溃日志:

Solid

1 个答案:

答案 0 :(得分:0)

您是否已在应用程序中加载库使用System.loadlibrary(yourlobraryname)?并检查它应该在您的应用程序库文件夹中可用。