android6.0的系统为什么在androidstudio中运行不了

如题所述

目前OpenCV在Android6.0遇到两个问题:(我用的是OpenCV2.4.9)
1、直接无法运行
2、找不到OpenCV Manager
第一个通常错误在于,出现三行可以追溯的OpenCV代码位置,点击第一个类AsyncServiceHelper
找到方法 initOpenCV
改为:

[java] view plain copy
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;
}
// if (AppContext.bindService(new Intent("org.opencv.engine.BIND"),
// helper.mServiceConnection, Context.BIND_AUTO_CREATE))
// {
// return true;
// }
else {
AppContext.unbindService(helper.mServiceConnection);
InstallService(AppContext, Callback);
return false;
}
}
即可(注释部分为源代码),然后就可以运行了。
问题2

测试在Android5.0.1可以正常运行,而在Android5.1.1和Android6.0都无法运行(找不到Android Manager,让你下载,然而下载后没用,还在寻找解决方案中,有知道的小伙伴告诉我一声哈)
温馨提示:答案为网友推荐,仅供参考
相似回答