运行Android原生code是导致java.lang.UnsatisfiedLinkError中 [英] Running android native code is causing java.lang.UnsatisfiedLinkError

查看:1073
本文介绍了运行Android原生code是导致java.lang.UnsatisfiedLinkError中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有本土code,其中我使用OpenCV库的Andr​​oid应用程序。当运行在所有的手机应用程序运作良好,但是当我尝试在平板电脑(联想瑜伽2 PRO)我遇到这个错误运行它:

I have an android app with native code where I use openCV library. When running the app in phone everything is working well but when I try to run it on tablet(Lenovo yoga 2 pro) I am encountering this error:

01-03 11:53:13.007: E/AndroidRuntime(25632): FATAL EXCEPTION: main
01-03 11:53:13.007: E/AndroidRuntime(25632): Process: <appname>, PID: 25632
01-03 11:53:13.007: E/AndroidRuntime(25632): java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/<appname>/libnative_module.so" has unexpected e_machine: 40
01-03 11:53:13.007: E/AndroidRuntime(25632):    at java.lang.Runtime.loadLibrary(Runtime.java:364)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at java.lang.System.loadLibrary(System.java:526)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at <appname>.SplashActivity$1.onManagerConnected(SplashActivity.java:35)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at org.opencv.android.AsyncServiceHelper$1.onServiceConnected(AsyncServiceHelper.java:318)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1127)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1144)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at android.os.Handler.handleCallback(Handler.java:733)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at android.os.Handler.dispatchMessage(Handler.java:95)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at android.os.Looper.loop(Looper.java:149)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at android.app.ActivityThread.main(ActivityThread.java:5283)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at java.lang.reflect.Method.invokeNative(Native Method)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at java.lang.reflect.Method.invoke(Method.java:515)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
01-03 11:53:13.007: E/AndroidRuntime(25632):    at dalvik.system.NativeStart.main(Native Method)

这是上线45 SplashActivity:

this is on the line 45 in SplashActivity:

System.loadLibrary("native_module");

有人可以帮助我解决这个错误?或者我是什么做错了吗?

Can someone help me to solve this error? or What am I doing wrong?

推荐答案

您的平板电脑是基于英特尔Atom处理器。你必须建立您的 native_module APP_ABI = 86 。请注意,您还需要的OpenCV的兼容版本。

Your tablet is based on Intel Atom CPU. You must build your native_module for APP_ABI=x86. Note that you also need the compatible version of OpenCV.

更新:在这种特殊情况下,应用程序是专为x86和ARM。但应用程序安装程序选择了错误的子文件夹,也许是因为文件名中的库/ 86 库/ armeabi did不完全匹配 的。对于具有不平凡的本地组件应用的可靠和有效的方法是上传单独的APK到Play商店中

Update: in this particular case, the app was built for both x86 and ARM. But the app installer chose the wrong subfolder, maybe because the filenames listed in libs/x86 and libs/armeabi did not exactly match. The reliable and efficient approach for apps that have non-trivial native component is to upload separate APKs to PlayStore.

这篇关于运行Android原生code是导致java.lang.UnsatisfiedLinkError中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆