1

我将 Google drive API 与我的 eclipse android 项目一起使用,该项目是以编程方式将图像上传到 google drive。我按照链接https://developers.google.com/drive/quickstart-android开发了一个示例应用程序,但是在 oncreate 方法中使用 OAuth2 时出错。

我收到错误,例如 GoogleAccountCredential 类型中的方法 usingOAuth2(Context, Collection) 不适用于给定行中的参数 (MainActivity, String)

     credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);

我知道这个错误在第二个参数中,但我按照谷歌驱动器给出的文档进行操作,所以如果我将 usingOAuth2 更改为 usingAudience 它执行但无法看到我上传到驱动器的图像,我需要更改参数帮我解决这个错误。提前致谢。

4

1 回答 1

5

不推荐使用 usingOAuth2 而不是我们必须使用 usingOAuth2(this, Arrays.asList(DriveScopes.DRIVE_FILE));

于 2013-10-24T10:24:53.400 回答