android - 错误 : cannot find symbol class GoogleAccountCredential

标签 android google-app-engine google-play-services build.gradle google-api-java-client

Android 构建失败并出现以下错误 -

Error:(23, 68) error: package com.google.api.client.googleapis.extensions.android.gms.auth does not exist
Error:(60, 20) error: cannot find symbol class GoogleAccountCredential
Error:(79, 19) error: cannot find symbol class GoogleAccountCredential
Error:(218, 22) error: cannot find symbol variable GoogleAccountCredential
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

我不知道这个类属于哪个库。包是

com.google.api.client.googleapis.extensions.android.gms.authc.GoogleAccountCredential;

我尝试在构建依赖项中添加所有库。现在看起来像下面 -

dependencies {

compile 'com.google.android.gms:play-services-plus:9.0.2'
compile 'com.google.android.gms:play-services-ads:9.0.2'
compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile 'com.google.android.gms:play-services-maps:9.0.2'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.google.android.gms:play-services-base:9.0.2'
compile 'com.google.android.gms:play-services-identity:9.0.2'

compile 'com.google.api-client:google-api-client:1.23.0'


compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.code.gson:gson:2.4'

// V2: Endpoints Framework v2 migration
endpointsServer project(path: ':DeviceLocatorBackend', configuration: 'endpoints')
compile 'com.google.api-client:google-api-client:+'
compile 'com.google.http-client:google-http-client-android:1.22.0'
}

最佳答案

必须添加以下依赖项才能使其工作 -

compile 'com.google.api-client:google-api-client-android:1.20.0'

关于android - 错误 : cannot find symbol class GoogleAccountCredential,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47843842/

相关文章:

android - 使用 Android 的 Parcel 编码和解码 List<List<T>>

google-app-engine - 如何通过 Cloud DNS api 将自定义域映射到应用程序引擎应用程序?

java - 查询 Google App Engine JDO 中的两个实体

java - 如何从 Qt 在 Android 客户端代码中调用 Google-Cloud-Messaging API?

android - 使用 Vision API 扫描反色二维码

android - Surfaceview 中 Canvas 的大小与实际屏幕分辨率的对比

android - 将姓名、电子邮件和电话号码添加到联系人数据库

java - 创建新的 GSCService 实例运行时错误

android - 应用在启动时崩溃

android - 获得二维码验证