Google Drive Api无法连接/授权到Google帐户 [英] Google Drive Api can't connect/authorize to google account

查看:794
本文介绍了Google Drive Api无法连接/授权到Google帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个集成了google drive api并将驱动器用作存储设备的android应用程序,但是我从一开始就遇到了问题。
我一直试图按照官方指南提供:
https://developers.google.com/drive/android/get-started
以及另一个指南,我发现 https://www.numetriclabz.com/integrate-google-drive-in-android-tutorial/ ,甚至下载源代码和只是更换我的API密钥,但是这两个指南我遇到了完全相同的问题。



每当我尝试运行应用程序以查看应用程序是否连接到驱动器时​​,我在控制台中获得以下输出:

  $ adb shell am start -napp.googledrive / app.googledrive.MainActivity-a android.intent.action.MAIN -c android.intent.category .LAUNCHER 
客户端尚未准备好...连接到设备模拟器上的进程2889 -5554
W / System:ClassLoader引用未知路径:/data/app/app.googledrive-1/lib/x86
I / InstantRun:即时运行运行时间已开始。 Android包是app.googledrive,真正的应用程序类是null。

[01-16 12:33:01.211 1561:1584 D /]
HostConnection :: get()建立新主机连接0x953a3740,tid 1584
W / System:ClassLoader引用的未知路径:/data/app/app.googledrive-1/lib/x86
I / GMPM:应用程序测量正在启动,版本:8487
I / GMPM:启用调试日志记录运行:adb shell setprop log.tag.GMPM VERBOSE
I / OpenGLRenderer:初始化的EGL,版本1.4
D / OpenGLRenderer:交换行为1
E / EGL_emulation:tid 2930:eglSurfaceAttrib(1174):error 0x3009 (EGL_BAD_MATCH)
W / OpenGLRenderer:无法在曲面0x94efd500上设置EGL_SWAP_BEHAVIOR,错误= EGL_BAD_MATCH
我/ Google云端硬盘活动:GoogleApiClient连接失败:ConnectionResult {statusCode = SIGN_IN_REQUIRED,resolution = PendingIntent {e061739:android。 os.BinderProxy@2c1717e},message = null}

另外Google Sign in也弹出来添加一个帐户给我,这意味着它连接到谷歌服务但是由于某种原因无法识别帐户/登录。我也尝试重新生成密钥库并将其添加到开发者控制台,并使用不受限制的密钥,但是出现同样的问题。



我非常感谢任何帮助或者如何解决这个问题的建议,谢谢。

解决方案

这不是答案,但它会帮助你。 p>

首先定义您要保存的Google帐户。如果用户使用他自己的帐户或者一些集中的帐户,整个辣酱玉米饼馅是完全不同的。

接下来,您需要决定您希望使用哪个API / SDK。假设您希望用户保存到自己的Google帐户,那么您可以选择使用REST API(使用或不使用Java SDK)或Android API。 REST API允许访问所有的驱动器功能,但只适用于手机处于在线状态并需要一点点争论才能获得授权的情况。 Google Drive Android API(GDAA)提供了许多功能,但更容易工作,并具有允许离线访问的优势。


I am trying to build an android app that integrates google drive api and uses the drive as the storage storage for it however I am after running into issue with it from the very beginning. I've been trying to follow the official guide available at: https://developers.google.com/drive/android/get-started and also another guide I found https://www.numetriclabz.com/integrate-google-drive-in-android-tutorial/ and even downloading the source code and just replacing my API Key however with both of these guides I run into the exact same issue.

Whenever I try to test run the app to see if the app is connecting to the drive i get the following output in the console:

$ adb shell am start -n "app.googledrive/app.googledrive.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Connected to process 2889 on device emulator-5554
W/System: ClassLoader referenced unknown path: /data/app/app.googledrive-1/lib/x86
I/InstantRun: Instant Run Runtime started. Android package is app.googledrive, real application class is null.

              [ 01-16 12:33:01.211  1561: 1584 D/         ]
              HostConnection::get() New Host Connection established 0x953a3740, tid 1584
W/System: ClassLoader referenced unknown path: /data/app/app.googledrive-1/lib/x86
I/GMPM: App measurement is starting up, version: 8487
I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
E/EGL_emulation: tid 2930: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x94efd500, error=EGL_BAD_MATCH
I/Google Drive Activity: GoogleApiClient connection failed: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{e061739: android.os.BinderProxy@2c1717e}, message=null}

Also the Google Sign in is popping up to add an account to me it means that it connects to the google server but doesn't recognize account/sign in for one or the other reason. I've also tried regenerating the keystore and adding it again to the developers console and using an unrestricted key however the same exact issue comes up.

I would highly appreciate any help or suggestions on how to solve this issue, thanks.

解决方案

This is not the answer, but it will help you.

Start by defining which Google Account you will be saving to. The whole enchilada is totally different if the user will be using his own account, or some centralised account.

Next you need to decide which API/SDK you wish to use. Assuming you want the user to save to his own Google account, you have a choice between using the REST API (with or without the Java SDK) or the Android API. The REST API allows access to all Drive features, but only works when the handset is online and requires a bit of wrangling to get authorised. The Google Drive Android API (GDAA) offers a subest of features, but is easier to get working and has the advantage of allowing offline access.

这篇关于Google Drive Api无法连接/授权到Google帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆