4

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)

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?

1

2 Answers 2

4

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.

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.

Sign up to request clarification or add additional context in comments.

13 Comments

I thought the same thing and I checked the APP_ABI but it is set like this: APP_ABI := armeabi armeabi-v7a x86 mips so it should be ok. How do you mean the compatible version of OpenCV? because when I downloaded the openCV for android there was no option for choosing the processor type
Do you use shared or static version of OpenCV?
In my project I have directory libs where are subfolders with .so and .a libraries for different processor types(these subfolders are from downloaded opencv project for android, in folder structure sdk/native/libs). And then I have linked opencv android project in eclipse(sdk/java).
You can verify the contents of the libs/ folder of your Eclipse project. In C/C++ perspective, you can see "binaries" tab, and it will list the so files that you have, marked for architecture (x86/arm/whatever). But you should also check which files are actually installed on the device.
How can I check which files are installed on device? But to run the app I had to download opencv manager app and this app is working(does not crash) so it is bit weird.
|
0

I have an Asus Zenfone 5 (which uses the x86 ABI) and I was having the same problem. Apparently the problem was with the OpenCV 2.x versions. Start using the OpenCV 3.x version and the problem is going to be solved.

The OpenCV 3.x version has more ABI options, such as:

arm64v8a
arm
armv7a
mips
mips64
x86
x86-64

You can find the 3.x version here.

Hope it helped!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.