android - Google Drive API - 未登录

标签 android google-drive-api

当我不使用 SIGNED APK 时,我的 Google Drive api 工作正常,如果我使用,它返回错误 code 17 -> public static final int SIGN_IN_FAILED = 17;

我在 proguard 规则中使用它:

-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault

-keepclassmembers class * {
  @com.google.api.client.util.Key <fields>;
}

-keep class com.google.** { *;}
-keep interface com.google.** { *;}
-dontwarn com.google.**

# Needed by google-http-client-android when linking against an older platform version
-dontwarn com.google.api.client.extensions.android.**

# Needed by google-api-client-android when linking against an older platform version
-dontwarn com.google.api.client.googleapis.extensions.android.**

我只有这些信息 =/,而且我在开发者控制台上有 api、 key 、sha1

最佳答案

您很可能生成的发布 APK 没有正确的 PackageName/SHA1 组合。检查这一点的最简单方法是以下步骤:

1/找到不工作的 APK。在解压器​​ (7-zip) 中打开“*.apk”文件,然后在存档中找到“META-INF\CERT.RSA”文件。将其解压缩到您的桌面

2/运行“keytool -printcert -file .\desktop\CERT.RSA”。 您应该会看到 APK 文件的“SHA1”。将其与开发控制台中的“SHA1”进行比较。

3/还要检查包名称(它在您的 list 中)。 “程序包名称”/“SHA1”对是授权 Google Drive 中的应用程序版本的内容。

祝你好运

关于android - Google Drive API - 未登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34166807/

相关文章:

Android-studio 项目运行失败

google-drive-api - Google Drive API 如何支持 Content-Range 下载请求?

java - 在不知道大小的情况下上传到 Google 云端硬盘

python - 如何使用 Drive API 在 Google 电子表格中获取工作表列表(名称和 "gid")?

google-drive-api - 使用 Drive REST API 的 files().list() 上出现内部服务器错误 500

android - MonoDroid : Error when calling constructor of custom view - TwoDScrollView

android - 如何重组布局以使其更好?

android - 如何增加android中的堆内存

android - 如何使用 Cordova 检查 android 设备中是否存在相机?

javascript - 使用 javascript 将 html(或 html 输出)渲染到 Google Drive Docs(word)