suco2007
suco2007

Reputation: 131

Cannot resolve method: CameraSource.Builder.setAutoFocusEnabled

I use Vision API to scan barcode. It's almost done, except auto-focus. I follow the guide in this link: https://developers.google.com/android/reference/com/google/android/gms/vision/CameraSource.Builder, use setAutoFocusEnabled method and get an error: "Cannot resolve method 'setAutoFocusEnabled(boolean)'"

My Android studio version: 2.1.1

JRE: 1.8.0

file build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "***"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.google.android.gms:play-services:7.8+'
}

Upvotes: 3

Views: 4149

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191723

You are reading newer documentation than the library you are using.

If you want the newer features, then upgrade.

Replace com.google.android.gms:play-services:7.8+

With com.google.android.gms:play-services-vision:10.0.0, or some other, later version than 7.8.

See about selective compilation. It will make your app smaller, and build faster.

Upvotes: 2

Related Questions