我有一个使用Google+登录的Android应用,并使用Google Cloud Endpoints拨打在Google App Engine上运行的服务。这些电话经过验证 - 用户在制作任何电话之前都会选择一个Google帐户,然后我们会在AsyncTask中使用生成的客户端库来调用服务API。
我们已将GoogleAccountCredential实例传递给Endpoints服务的构建器以及应用程序中的其他活动,我可以使端点调用正常。我可以看到这个问题活动与其他活动没有区别。例外是可重复的。这是堆栈跟踪:
com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:284)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:858)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at com.eliotstock.bike.task.ProvisionDeviceTask.doInBackground(ProvisionDeviceTask.java:55)
at com.eliotstock.bike.task.ProvisionDeviceTask.doInBackground(ProvisionDeviceTask.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Caused by: com.google.android.gms.auth.UserRecoverableAuthException: AppDownloadRequired
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:255)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:279)
... 12 more
以下是构建服务的活动代码:
Biketracker.Builder builder = new Biketracker.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), googleAccountCredential);
this.endpointsService = builder.build();
并执行Endpoints方法:
Biketracker.User.ProvisionDevice provisionDevice = endpointsService.user().provisionDevice(deviceId);
provisionDevice.execute();
我甚至不知道" AppDownloadRequired"的意思。哪个应用?在调试时,我已经找到了一个Intent,因为我可能会触发它,但它是null。在其他地方搜索的情况很少。迷惑。