javagoogleauthutil。getToken Android客户端Google云端点
我在appengine中有以下实体
@Api(
name = "profileendpoints",
version = "v1",
scopes = {EMAIL_SCOPE},
clientIds = {ANDROID_CLIENT_ID, API_EXPLORER_CLIENT_ID, WEB_CLIENT_ID},
audiences = {WEB_CLIENT_ID}
)
public class ProfileEndPoints {
...
}
在安卓项目中,在MainActivity的onCreate方法中,我有ff:
settings = getSharedPreferences("profile", 0);
credential = GoogleAccountCredential.usingAudience(this,
"server:client_id:" + WEB_CLIENT_ID);
但我得到了以下错误:
I/dalvikvm(477): Could not find method
com.google.安卓.gms.auth.GoogleAuthUtil.getToken, referenced from method
com.google.api.client.googleapis.extensions.安卓.gms.auth.GoogleAccountCredential.getToken
我的安卓项目的libs
文件夹中有以下jar文件
google-api-client-1.16.0-rc.jar
google-api-client-安卓-1.16.0-rc.jar
google-http-client-1.16.0-rc.jar
google-http-client-安卓-1.16.0-rc.jar
google-http-client-gson-1.16.0-rc.jar
google-oauth-client-1.16.0-rc.jar
gson-2.1.jar
jsr305-1.3.9.jar
# 1 楼答案
该方法是Google Play服务的一部分。确保Google Play Services是installed,作为项目的依赖项添加,并且在运行应用程序的设备(或模拟器)上可用