JR Galia
JR Galia

Reputation: 17269

GoogleAuthUtil.getToken Android Client - Google Cloud Endpoints

I have the following entity in 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 {
    ...
}

In android project, in onCreate method of MainActivity, I have the ff:

    settings = getSharedPreferences("profile", 0);
    credential = GoogleAccountCredential.usingAudience(this,
       "server:client_id:" + WEB_CLIENT_ID);

But I got the following error:

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

I have the following jar files in libs folder of my android project.

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

Upvotes: 3

Views: 1010

Answers (1)

Dan Holevoet
Dan Holevoet

Reputation: 9183

That method is part of Google Play Services. Make sure Google Play Services is installed, added as a dependency to your project, and available on the device (or emulator) you're running the app on.

Upvotes: 2

Related Questions