Google Drive Client API + Android无效

时间:2014-08-24 22:34:51

标签: android google-drive-api

我正在尝试编写一个Android应用程序作为初学者,到目前为止没有运气!我正在尝试从用户云端硬盘帐户中获取图像文件列表。随着我的探索,我们发现Google Drive for Android API并未提供完整的访问范围。所以我必须使用Google API for Java Client。我尝试下载sample example from here。这个任务应用程序在我的手机上完美运行。所以现在我已将此应用更改为与Google云端硬盘配合使用。但它始终在this file中抛出异常。我的代码中的第38行读为client.files().list().execute().getItems(); //客户端在其他文件中定义为Drive变量,我正在尝试从用户帐户获取文件列表。

例外是:

08-24 15:00:33.712  15422-15473/gattasrikanth.googledrive.example E/DriveSample﹕ Error
com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException
        at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:286)
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
        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 gattasrikanth.googledrive.example.AsyncLoadTasks.doInBackground(AsyncLoadTasks.java:40)
        at gattasrikanth.googledrive.example.CommonAsyncTask.doInBackground(CommonAsyncTask.java:57)
        at gattasrikanth.googledrive.example.CommonAsyncTask.doInBackground(CommonAsyncTask.java:35)
        at android.os.AsyncTask$2.call(AsyncTask.java:288)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:841)
 Caused by: com.google.android.gms.auth.GoogleAuthException: Unknown
        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)
            at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
            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 gattasrikanth.googledrive.example.AsyncLoadTasks.doInBackground(AsyncLoadTasks.java:40)
            at gattasrikanth.googledrive.example.CommonAsyncTask.doInBackground(CommonAsyncTask.java:57)
            at gattasrikanth.googledrive.example.CommonAsyncTask.doInBackground(CommonAsyncTask.java:35)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)

任何错误的想法。 我在Google Console上正确设置了项目包,SHA1。 不确定为什么它与TasksAPI一起使用而不是与Drive API一起使用。

0 个答案:

没有答案