本文介绍了错误:包android.hardware.camera2不存在OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将OpenCV模块添加到项目中,但是无法解决某些问题.这是我的app.gradle文件:

I'm trying to add the OpenCV module to a project, but I'm not able to solve some gradle issues. Here is my app.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 17
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.sveder.cardboardpassthrough"
        minSdkVersion 8
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile files('libs/cardboard.jar')
    compile project(':openCVLibrary')
}

这是OpenCV(3.0)模块的build.gradle文件:

Here's the build.gradle file of the OpenCV (3.0) module:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 17
    buildToolsVersion "23.0.2"

defaultConfig {
    minSdkVersion 8
    targetSdkVersion 21
}

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

如您所见,我的应用程序和OpenCV gradle文件匹配,但是每当我尝试构建项目时,我都不会出现错误error: package android.hardware.camera2.我在做什么错了?

As you can see, my app and OpenCV gradle files match, and yet whenever I try to build the project I have the error error: package android.hardware.camera2 does not exist. What am I doing wrong?

提前谢谢.

推荐答案

compileSdkVersion 17更改为最小21(建议最新).因为android.hardware.camera2添加在API 21中的.

Change compileSdkVersion 17 to minimum 21 (recommended latest). Because android.hardware.camera2 was added in API 21.

这篇关于错误:包android.hardware.camera2不存在OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 08:39