Android-带有 google 驱动器的快速启动应用程序无法运行
Android-quick start app with google drive is not working
我正在尝试使用快速入门教程将图像上传到 google 驱动器,最初我的应用程序启动并要求选择帐户,但是当我 select 一个帐户时,它会一次又一次地询问。
如代码所示,没有传递账户名。如果您喜欢设置多个帐户,请尝试设置 useDefaultAccount()
method which will specify that the default account should be used when connecting to services. Otherwise, use clearDefaultAccountAndReconnect()
方法。此方法将清除所选帐户并提示用户在重新连接前选择一个帐户。
有关 sign_in
的更多信息,请参阅 GoogleApiClient。
除此之外,另请参阅 installation and configuration of the Google Play services SDK 关于创建凭据。
如果您还没有这样做,请检查为您的项目创建的凭据。以下是步骤:
- Open the Credentials page in the API Console.
Follow these steps if your application needs to submit authorized
requests:
a. Click Create credentials > OAuth client ID.
b. Select Android.
c. In the Package name field, enter your Android app's package name.
d. Paste the SHA1 fingerprint into the form where requested.
e. Click Create.
Otherwise, follow the steps below, which are for applications that only need to make unauthorized API calls:
a. Click Create credentials > API key.
b. Select Android key.
c. Paste the SHA1 fingerprint into the form where requested.
d. Type your Android app's package name into the form where requested.
e. Click Create.
我正在尝试使用快速入门教程将图像上传到 google 驱动器,最初我的应用程序启动并要求选择帐户,但是当我 select 一个帐户时,它会一次又一次地询问。
如代码所示,没有传递账户名。如果您喜欢设置多个帐户,请尝试设置 useDefaultAccount()
method which will specify that the default account should be used when connecting to services. Otherwise, use clearDefaultAccountAndReconnect()
方法。此方法将清除所选帐户并提示用户在重新连接前选择一个帐户。
有关 sign_in
的更多信息,请参阅 GoogleApiClient。
除此之外,另请参阅 installation and configuration of the Google Play services SDK 关于创建凭据。
如果您还没有这样做,请检查为您的项目创建的凭据。以下是步骤:
- Open the Credentials page in the API Console.
Follow these steps if your application needs to submit authorized requests:
a. Click Create credentials > OAuth client ID.
b. Select Android.
c. In the Package name field, enter your Android app's package name.
d. Paste the SHA1 fingerprint into the form where requested.
e. Click Create.
Otherwise, follow the steps below, which are for applications that only need to make unauthorized API calls:
a. Click Create credentials > API key.
b. Select Android key.
c. Paste the SHA1 fingerprint into the form where requested.
d. Type your Android app's package name into the form where requested. e. Click Create.