GoogleAuthUtil.getToken Android客户端 - Google Cloud Endpoints

时间:2013-12-18 04:39:24

标签: java android google-app-engine google-cloud-endpoints

我在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 {
    ...
}

在android项目中,在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.android.gms.auth.GoogleAuthUtil.getToken, referenced from method 
com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken

我的android项目的libs文件夹中有以下jar文件。

google-api-client-1.16.0-rc.jar
google-api-client-android-1.16.0-rc.jar
google-http-client-1.16.0-rc.jar
google-http-client-android-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 个答案:

答案 0 :(得分:2)

该方法是Google Play服务的一部分。确保Google Play服务为installed,作为项目的依赖项添加,并在您运行应用程序的设备(或模拟器)上提供。