无法从我的Android应用上传到谷歌驱动器

时间:2014-01-03 16:24:56

标签: java android google-app-engine google-drive-api

我正在编写一个用于上传所选图片的adroid应用

到用户的谷歌硬盘。

我已将代码从git克隆到另一台机器,然后图像将不再上传。

我收到com.google.android.gms.auth.GoogleAuthException: Unknown个例外。但它被抓住了:

 } catch (IOException e) {
          e.printStackTrace();
        }

enter image description here

      if(fileContent.length() > 5 * 1024 * 1024)
      {
          // Resumable Uploads when the file size exceeds a file size of 5 MB.
          // check link : 
          // 1) https://code.google.com/p/google-api-java-client/source/browse/drive-cmdline-sample/src/main/java/com/google/api/services/samples/drive/cmdline/DriveSample.java?repo=samples&r=08555cd2a27be66dc97505e15c60853f47d84b5a
          // 2) http://stackoverflow.com/questions/15970423/uploading-downloading-of-large-size-file-to-google-drive-giving-error

          AbstractGoogleClientRequest<File> insert = mDriveService.files().insert(body, mediaContent);
          MediaHttpUploader uploader = insert.getMediaHttpUploader();
          uploader.setDirectUploadEnabled(false);
          uploader.setProgressListener(new FileUploadProgressListener());
          destFile = (File) insert.execute();

      }   
      else
      {
          // Else we go by Non Resumable Uploads, which is safe for small uploads.
          destFile = mDriveService.files().insert(body, mediaContent).execute();
      }

任何提示我可以检查和验证(可能缺少库引用?)

enter image description here

enter image description here

我原以为是因为我从外部SD上传了一张图片,但即使我从本地手机SD中选择它也会引发相同的异常

0 个答案:

没有答案