Issue with OpenCV for Android on Android 5.0 (lollipop)

后端 未结 2 1013
长情又很酷
长情又很酷 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.

提交回复
热议问题