Android 工作室 - Google Play 游戏服务登录失败
Posted
技术标签:
【中文标题】Android 工作室 - Google Play 游戏服务登录失败【英文标题】:Android studio - Google Play Game Services sign in fails 【发布时间】:2016-02-11 07:50:41 【问题描述】:我知道,这个问题已经以多种形式存在,但我仍然无法解决我的问题。 问题是,当我运行我的应用程序并尝试使用 Google Play 游戏服务登录时,它会向我显示以下消息:
“应用程序配置不正确。检查包名称和签名证书是否与在开发者控制台中创建的客户端 ID 匹配。此外,如果应用程序尚未发布,请检查您尝试登录的帐户被列为测试人员帐户。有关详细信息,请参阅日志。”
我已经尝试过的:
确保我的 androidManifest.xml 上的包名正确 检查了我的 SHA1 并与我链接的应用程序的 SHA1 进行了比较(为了确定,甚至创建了一个具有相同 SHA1 的新应用程序) 已将我的 Google+ 帐户添加到测试人员列表中编写代码:
android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"
在我的字符串值中使用正确的 ID
但错误仍未修复。现在我只是认为问题出在代码段上:
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
但我无法找到这个值来检查它(我正在处理一个 libgdx 项目,而 google_play_service 包不在我的项目层次结构中,但其他一切都很好)。不确定这是否是我的问题,我还能做什么?
【问题讨论】:
您没有使用调试密钥库的 SHA1,对吧?您是否使用正确的密钥签署了 APK? 不要调试。选择发布。 我只有一个键,我从来没有创建过调试键 【参考方案1】:如果您正在测试您的应用,请务必从调试证书开始。
总而言之:当您应该使用调试 SHA 时,通常会发生这种情况,但您使用的是链接应用的发布信息(授权应用时在 Google Play 开发者控制台中填写的部分)。
你可能已经知道很多了,但是:
通过单击 Android Studio 最右侧的垂直 Gradle 选项卡,转到您的 Gradle 视图。
或者您可以使用菜单打开它:视图 > 工具窗口 > Gradle
Gradle 视图打开后,如下所示:
双击上面以蓝色突出显示的名为 signingReport 的部分(在:app / Tasks / android 中)。
这通常会在 Android Studio 的“运行”窗格中运行签名报告(位于界面底部,通常在默认情况下使用 Android 监视器)。您可以通过复制您自己的签名报告中的行来获取您的调试 SHA1,我在下图中用红色标出了其位置(SHA1 的示例,不包括最后的省略号,如下所示):
cf:23:df:22:07:d9:9a:74:fb...
然后,当 Google Play 开发者控制台要求提供 SHA1 时,您会将其粘贴到链接的应用程序部分。
您是否已经创建了调试 APK?如果您还没有,那是您可能需要查看的其他内容:
http://developer.android.com/tools/publishing/app-signing.html#studio
您可以像创建发布 APK 一样创建调试 APK,但在上面链接的最后一步,选择调试,而不是发布。
还可以查看此内容,了解您可能偏离轨道的其他地方:Google Play Game Services : Debug AND Release certificate
特别是如果您使用 Google Developer Console 而不是 Google Play Developer Console。
【讨论】:
【参考方案2】:我遇到了这个错误(在从谷歌游戏服务控制台导出 ids.xml
后),我通过以下方式修复了它:
-
为游戏启用详细日志记录:
adb shell setprop log.tag.Games VERBOSE
然后我让错误发生并得到了这个错误:
2019-07-25 20:30:20.189 2241-28188/? E/SignInAuthenticator: ****
**** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
**** This is usually caused by one of these reasons:
**** (1) Your package name and certificate fingerprint do not match
**** the client ID you registered in Developer Console.
**** (2) Your App ID was incorrectly entered.
**** (3) Your game settings have not been published and you are
**** trying to log in with an account that is not listed as
**** a test account.
****
**** To help you debug, here is the information about this app
**** Package name : com.my.package.name
**** Cert SHA1 fingerprint: AB:CD:EF:12:34:56:78:90:....
**** App ID from manifest : 1234567890123
****
**** Check that the above information matches your setup in
**** Developer Console. Also, check that you're logging in with the
**** right account (it should be listed in the Testers section if
**** your project is not yet published).
****
**** For more information, refer to the troubleshooting guide:
**** http://developers.google.com/games/services/android/troubleshooting
****
从错误消息中复制哈希并转到 google play services 控制台。
-
点击游戏服务
点击你的游戏
点击链接的应用程序
链接另一个应用程序
点击安卓
填写详细信息
点击保存并继续
在弹出的框中,粘贴上面的 SHA1 哈希
点击保存,然后发布更改
【讨论】:
以上是关于Android 工作室 - Google Play 游戏服务登录失败的主要内容,如果未能解决你的问题,请参考以下文章
Google Play 服务在 Android 2.3 Vision API 上崩溃
无法解析 com.google.android.gms:play-services-measurement-base:[18.0.0]
Android 2.2 将 Highscore 发布到 google play 服务