Android 无法解析方法:CameraSource.Builder.setAutoFocusEnabled

Android 无法解析方法:CameraSource.Builder.setAutoFocusEnabled,android,android-camera,android-vision,Android,Android Camera,Android Vision,我使用Vision API扫描条形码。它几乎完成了,除了自动对焦。我按照此链接中的指南进行操作:,使用setAutoFocusEnabled方法并得到一个错误:“无法解析方法'setAutoFocusEnabled(布尔)'” 我的Android studio版本:2.1.1 JRE:1.8.0 文件build.gradle: apply plugin: 'com.android.application' android { compileSdkVersion 23 build

我使用Vision API扫描条形码。它几乎完成了,除了自动对焦。我按照此链接中的指南进行操作:,使用setAutoFocusEnabled方法并得到一个错误:“无法解析方法'setAutoFocusEnabled(布尔)'”

我的Android studio版本:2.1.1

JRE:1.8.0

文件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+'
}

您正在阅读比所用库更新的文档

如果需要更新的功能,请升级

替换
com.google.android.gms:play services:7.8+

使用
com.google.android.gms:play services vision:10.0.0
,或其他比
7.8
更高的版本


看看。它将使你的应用程序更小,构建速度更快

gms:play services:7.8+
。。。您知道该库的最新版本现在是
10.0
?好的,谢谢。我运行我的应用程序,但它不会自动对焦。我确信我的手机(HTC M8)支持自动对焦(当我使用相机应用程序时)。我错过什么了吗?