Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: package android.hardware.camera2 does not exist OpenCV

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') } 

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'         }     } } 

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?

Thanks in advance.

like image 485
user3059347 Avatar asked Mar 24 '16 16:03

user3059347


People also ask

What is Camera2 in Android?

Camera2 is the latest low-level Android camera package and replaces the deprecated Camera class. Camera2 provides in-depth controls for complex use cases, but requires you to manage device-specific configurations. You can read about specific Camera2 classes and functions in the reference documentation.

Is Camera2 deprecated?

hardware. camera2 API for new applications. This class was deprecated in API level 21.


1 Answers

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

like image 148
Rohit Arya Avatar answered Oct 01 '22 03:10

Rohit Arya