3

我使用 Vision API 来扫描条形码。它几乎完成了,除了自动对焦。我遵循此链接中的指南:https://developers.google.com/android/reference/com/google/android/gms/vision/CameraSource.Builder,使用setAutoFocusEnabled方法并收到错误:“无法解析方法'setAutoFocusEnabled (布尔值)'"

我的安卓工作室版本:2.1.1

杰瑞: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+'
}
4

1 回答 1

2

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

如果您想要更新的功能,请升级。

代替com.google.android.gms:play-services:7.8+

使用com.google.android.gms:play-services-vision:10.0.0或其他一些比7.8.

请参阅选择性编译。它将使您的应用程序更小,并更快地构建。

于 2016-11-23T04:33:41.330 回答