Search code examples
androidopencvcard.io

Card.io not loading camera only showing form


The problem I am running into is, when implementing the card.io library, it was adding the opencv library to my apk 2x as I am already using the opencv library. I updated my build.gradle to resolved that issue:

packagingOptions {    
    pickFirst 'lib/x86/libopencv_core.so'
    pickFirst 'lib/x86/libopencv_imgproc.so'
}

Now when I run my app and open the card.io Activity I get the following in my logcat:

I/card.io: card.io 5.5.0  01/26/2017 16:20:26 -0500
D/card.io: Loaded card.io decider library.
D/card.io:     nUseNeon(): false
D/card.io:     nUseTegra():false
D/card.io:     nUseX86():  true
D/card.io: Loaded opencv core library
D/card.io: Loaded opencv imgproc library
E/card.io: Failed to load native library: dlopen failed: cannot locate symbol "_ZN2cv9ExceptionC1EiRKSsS2_S2_i" referenced by "/data/app/com.unrapp.newapp-7ljGOwnnhHqi2y4fZHeVfw==/lib/x86/libcardioRecognizer.so"...
I/card.io: Processor not Supported. Skipping camera.

Also, if I remove my implementation of openCV and my manifest changes the card.io works as expected, what am I missing??

I am running this in emulator but have tested the same outcome occurs on a real device.

Any help is greatly appreciated!

UPDATE After some searching, It seems that card.io is using openCV version 2.4.13-0

So I attempted to change the openCV version I am using, which started the card.io camera functions working again, but that is causing another error in my project.

Fatal Exception: java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
   at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:59)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
   at java.util.concurrent.FutureTask.run(FutureTask.java:237)
   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
   at java.lang.Thread.run(Thread.java:762)
Caused by java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.unrapp.newapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.unrapp.newapp-1/lib/arm, /system/fake-libs, /data/app/com.xxx.newapp-1/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]] couldn't find "libjniopencv_core.so"

So from what I take it is looking for 'libjniopencv_core.so' is that something that is not in this older version? I was using version: 3.1.0-1.3

I am not farmiliar with OpenCV so I'm not sure if there is something in the code specifically loading this file, a freelancer did our OpenCV work a long while back. Any help or input is appreciated!


Solution

  • To fix this I had to get a java developer better than myself to compile card.io using the later 3.1.0-1.3 version of openCV.