我在应用引擎中有以下实体
@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
最佳答案
该方法是 Google Play 服务的一部分。确保 Google Play 服务是 installed ,作为依赖项添加到您的项目,并在您运行该应用程序的设备(或模拟器)上可用。
关于java - GoogleAuthUtil.getToken Android 客户端 - Google Cloud Endpoints,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20649747/