Issue with OpenCV for Android on Android 5.0 (lollipop)

后端 未结 2 1009
长情又很酷
长情又很酷 2020-12-11 10:28

First of all, none of the OpenCV samples work on Nexus 6 Android 5.0. After the OpenCV manager installation prompt, I get a screen that says \'Item not found, retry\'. I lat

相关标签:
2条回答
  • 2020-12-11 10:46

    The best workaround I saw is to update the OpenCV's AsyncServiceHelper by yourself while they don't commit a official fix.

    You just have to add one line. It's very simple.

    Look for initOpenCV function and change it to be like that:

    public static boolean initOpenCV(String Version, final Context AppContext,
        final LoaderCallbackInterface Callback) {
        AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext,
                Callback);
        Intent intent = new Intent("org.opencv.engine.BIND");
        intent.setPackage("org.opencv.engine");
        if (AppContext.bindService(intent, helper.mServiceConnection,
                Context.BIND_AUTO_CREATE)) {
            return true;
        } else {
            AppContext.unbindService(helper.mServiceConnection);
            InstallService(AppContext, Callback);
            return false;
        }
    }
    

    Hope to help.

    0 讨论(0)
  • 2020-12-11 10:51

    I found a temporary fix for this. I debugged the 'AsyncServiceHelper' class. It is failing to obtain path at

    String path = mEngineService.getLibPathByVersion(mOpenCVersion); 
    

    So, I hard coded the path string like below and my Nexus 6 is now ready to run my program which uses OpenCV

    String path = "/data/data/org.opencv.engine/lib";
    
    0 讨论(0)
提交回复
热议问题