这是由于Android到了5.0版本也就是api>=21以后的一些新特性造成的。这时只需要改一下你的opencv library工程的org.opencv.android.AsyncServiceHelper的initOpenCV方法为如下:
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;
}
}
本文介绍了解决Android 5.0及以上版本中遇到的OpenCV兼容性问题的方法。通过修改org.opencv.android.AsyncServiceHelper的initOpenCV方法实现设备和服务之间的正确绑定。
8万+

被折叠的 条评论
为什么被折叠?



