我尝试将OpenCV集成到GearVR项目中,我的最终目标是使用" sepia"过滤一个OpenCV样本,以便在" sepia"中看到世界通过GearVR过滤(以及后来的其他过滤器)。
这是我的流程和问题: 首先,我关注" https://developer.oculus.com/documentation/mobilesdk/latest/concepts/mobile-new-apps-intro/"创建从VrTemplate复制的新项目(oculus mobile sdk中包含的示例)。通过build.cmd运行它,创建2个扭曲的绿色"圆圈"准备好在屏幕上使用GearVR。
然后我打开Android Studio和" file-new-import项目"并在新创建的项目中选择build.gradle文件(C:\ Dev1 \ ovr_sdk_mobile_1.0.3 \ VrSamples \ Native \ VrAndOpenCVApp \ Projects \ Android \ build.gradle),VrAndOpenCVApp是我之前创建的项目的名称。
通过Android Studio运行也可以。
现在我想要OpenCV 3.1.0并且我遵循本教程:" https://chmod600blog.wordpress.com/2016/02/22/how-to-add-opencv-3-1-0-to-android-studio/"。我已经通过首先创建一个新应用程序来测试它,并且该过程很简单且有效。但是,现在我必须将它放入GearVR-ready模板应用程序中。 在"文件 - 新导入模块","文件 - >之后项目结构"选择" Android"左侧的模块(" Android"必须是模板提供的标准名称,而不是" app"当您创建自己的新应用时)。 "依存关系"标签 - > " +" - > "模块依赖"并选择我刚刚添加的openCVLibrary310。 这里出现错误"错误:配置名称'默认'没找到。"出现了,这将一直伴随着我,直到最后。本教程的第12步,我打开" C:\ Dev1 \ ovr_sdk_mobile_1.0.3 \ VrSamples \ Native \ VrAndOpenCVApp \ Projects \ Android \ openCVLibrary310 \ build.gradle"和" C:\ Dev1 \ ovr_sdk_mobile_1.0.3 \ VrSamples \ Native \ VrAndOpenCVApp \ Projects \ Android \ build.gradle" ,我调整compileSdkVersion,buildToolsVersion,defaultConfig / minSdkVersion和defaultConfig / targetSdkVersion
的值android {
compileSdkVersion 19
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
}
同步Gradle文件后出现错误&#34;错误:配置名称&#39;默认&#39;没找到。&#34;遗迹。我不知道如何获得有关此错误的更多信息,谷歌搜索给了我一些建议,但我不确定我是否错误地应用了它们,或者它们是否适用于我的问题。< / p>
我试过了:
模板项目文件夹中的openCVLibrary310的build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
模板app的build.gradle(忽略buildtools,我只测试不同的)
apply plugin: 'com.android.application'
apply from: "${rootProject.projectDir}/VrApp.gradle"
dependencies {
compile project(':VrAppFramework:Projects:AndroidPrebuilt')
compile project(':VrAppSupport:SystemUtils:Projects:AndroidPrebuilt')
compile project(':VrAppSupport:VrGUI:Projects:AndroidPrebuilt')
compile project(':VrAppSupport:VrLocale:Projects:AndroidPrebuilt')
compile project(':VrAppSupport:VrSound:Projects:AndroidPrebuilt')
//compile project(':VrSamples:Native:VrAndOpenCVApp:Projects:Android:openCVLibrary310') //same error
compile project(':openCVLibrary310')
}
android {
project.archivesBaseName = "VrAndOpenCVApp"
defaultConfig {
applicationId "com.daprlab.VrAndOpenCVApp"
}
compileSdkVersion 23
buildToolsVersion '24.0.0'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['../../java']
jniLibs.srcDir 'libs'
res.srcDirs = ['../../res']
assets.srcDirs = ['../../assets']
}
}
}
模板项目的settings.gradle
rootProject.projectDir = new File(settingsDir, '../../../../..')
rootProject.name = "VrAndOpenCVApp"
include ':', \
'VrApi:Projects:AndroidPrebuilt', \
'VrAppFramework:Projects:AndroidPrebuilt', \
'VrAppSupport:VrLocale:Projects:AndroidPrebuilt', \
'VrAppSupport:VrSound:Projects:AndroidPrebuilt', \
'VrSamples:Native:VrAndOpenCVApp:Projects:Android', \
'VrAppSupport:SystemUtils:Projects:AndroidPrebuilt', \
'VrAppSupport:VrGUI:Projects:AndroidPrebuilt'
include ':openCVLibrary310'
toplevel中的settings.gradle
rootProject.projectDir = new File(settingsDir, '.')
rootProject.name = "OculusRoot"
include ':VrApi:Projects:AndroidPrebuilt', \
':VrAppFramework:Projects:AndroidPrebuilt', \
':VrAppSupport:SystemUtils:Projects:AndroidPrebuilt', \
':VrAppSupport:VrLocale:Projects:AndroidPrebuilt', \
':VrAppSupport:VrSound:Projects:AndroidPrebuilt', \
':VrAppSupport:VrGUI:Projects:AndroidPrebuilt'
include ':LibOVRKernel:Projects:Android', \
':VrAppFramework:Projects:Android', \
':VrCapture:Projects:Android', \
':VrApi:Impl:Projects:Android', \
':VrApi:Loader:Projects:Android', \
':VrAppSupport:SystemUtils:Projects:Android', \
':VrAppSupport:VrGUI:Projects:Android', \
':VrAppSupport:VrLocale:Projects:Android', \
':VrAppSupport:VrModel:Projects:Android', \
':VrAppSupport:VrSound:Projects:Android'
include ':openCVLibrary310'