Loading OpenCV on android fail sometimes
hello, i am working on android app using open cv library, so i have to load open cv on (onResume) of my activity:
try {
if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, con, new LoaderCallbackInterface() {
@Override
public void onPackageInstall(int operation, InstallCallbackInterface callback) {
}
@Override
public void onManagerConnected(int status) {
}
})) {
Toast.makeText(con, "cannot connect to opencv ", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
Log.e("Utilities", "can not load opencv, an exception has been thrown while.");
}
now my problem is sometimes and with unspecific conditions the open cv load fail and give me this LogCat:
V/Main(7042): OnCreate
V/Main(7042): onResume
D/OpenCVManager/Helper(7042): Service connection created
D/OpenCVManager/Helper(7042): Trying to get library path
W/System.err(7042): android.os.DeadObjectException
W/System.err(7042): at android.os.BinderProxy.transact(Native Method)
W/System.err(7042): at org.opencv.engine.OpenCVEngineInterface$Stub$Proxy.getLibPathByVersion(OpenCVEngineInterface.java:137)
W/System.err(7042): at org.opencv.android.AsyncServiceHelper$1.onServiceConnected(AsyncServiceHelper.java:182)
W/System.err(7042): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1097)
W/System.err(7042): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1114)
W/System.err(7042): at android.os.Handler.handleCallback(Handler.java:615)
W/System.err(7042): at android.os.Handler.dispatchMessage(Handler.java:92)
W/System.err(7042): at android.os.Looper.loop(Looper.java:137)
W/System.err(7042): at android.app.ActivityThread.main(ActivityThread.java:4898)
W/System.err(7042): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(7042): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err(7042): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
W/System.err(7042): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
W/System.err(7042): at dalvik.system.NativeStart.main(Native Method)
D/OpenCVManager/Helper(7042): Init finished with status 255
D/OpenCVManager/Helper(7042): Unbind from service
D/OpenCVManager/Helper(7042): Calling using callback
E/OpenCVLoader/BaseLoaderCallback(7042): OpenCV loading failed!
D/AndroidRuntime(7042): Shutting down VM
W/dalvikvm(7042): threadid=1: thread exiting with uncaught exception (group=0x420b32a0)
so what is this problem and why "OpenCV loading failed!" and how to solve it? Please answer me as soon as possible :)