应用程序未正确配置为使用 Google Play 游戏服务

问题描述 投票:0回答:7

我正在使用

BaseGameActivity
类连接到 google play 游戏服务。问题是身份验证在某种程度上不起作用。我在网上搜索解决方案几个小时,但没有找到任何可以帮助我解决问题的内容。

当我启动 BaseGameActivity 时,我在 LogCat 中得到以下输出:

03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
03-19 14:22:36.126: W/GameHelper(15312): **** This is usually caused by one of these reasons:
03-19 14:22:36.126: W/GameHelper(15312): **** (1) Your package name and certificate fingerprint do not match
03-19 14:22:36.126: W/GameHelper(15312): ****     the client ID you registered in Developer Console.
03-19 14:22:36.126: W/GameHelper(15312): **** (2) Your App ID was incorrectly entered.
03-19 14:22:36.126: W/GameHelper(15312): **** (3) Your game settings have not been published and you are 
03-19 14:22:36.126: W/GameHelper(15312): ****     trying to log in with an account that is not listed as
03-19 14:22:36.126: W/GameHelper(15312): ****     a test account.
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** To help you debug, here is the information about this app
03-19 14:22:36.126: W/GameHelper(15312): **** Package name         : *****
03-19 14:22:36.126: W/GameHelper(15312): **** Cert SHA1 fingerprint: *****
03-19 14:22:36.126: W/GameHelper(15312): **** App ID from          : *****
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** Check that the above information matches your setup in 
03-19 14:22:36.126: W/GameHelper(15312): **** Developer Console. Also, check that you're logging in with the
03-19 14:22:36.126: W/GameHelper(15312): **** right account (it should be listed in the Testers section if
03-19 14:22:36.126: W/GameHelper(15312): **** your project is not yet published).
03-19 14:22:36.126: W/GameHelper(15312): ****
03-19 14:22:36.126: W/GameHelper(15312): **** For more information, refer to the troubleshooting guide:
03-19 14:22:36.126: W/GameHelper(15312): ****   http://developers.google.com/games/services/android/troubleshooting

我检查了十多次,包名称、Cert SHA1 指纹和应用程序 ID(我在此处加星标)确实与 https://console.developers.google.com/project/my-app- 中给出的内容相同id/apiui/凭证

我还多次删除了那里给出的客户端 ID 并重新创建了它们。但没有任何帮助。你能帮我吗?

java android google-api google-play-services google-play-games
7个回答
10
投票

就我而言,SHA1 指纹不正确。

  1. 转至 Google Play 开发者控制台,找到您的游戏
  2. 转到左侧的“游戏详细信息”选项卡
  3. 向下滚动到“API 控制台项目”,然后单击“项目名称”
  4. 现在在 Google 开发者控制台(不同控制台)中,转到 API 管理器
  5. 单击“凭据”选项卡
  6. 在 OAuth 2.0 客户端 ID 下,单击您的项目名称
  7. 现在,您终于可以根据需要更改 SHA1 指纹和/或包名称。

3
投票

您在设备上登录的用户需要是有效的测试人员帐户。 检查设备上登录的用户是否配置为有效的测试用户。如果没有,则将您登录设备时使用的电子邮件添加到 Google Play 游戏开发者控制台上的测试人员帐户


0
投票

当您从 eclipse 本身安装并运行游戏/应用程序到您的设备上时,它不会登录并连接到 google 游戏服务。请按照以下说明操作,
我。您必须先导出游戏/应用程序(导出前构建项目) 二.并将app.apk文件上传到设备 三.安装并运行游戏/应用程序,您将看到谷歌登录窗口。


0
投票

你尝试过这个吗? 调试时生成的证书 SHA1 指纹与我正在使用的密钥库不匹配在我的情况下,我正在调试中测试应用程序,并且该证书与授权证书不同。


0
投票

确保使用正确的 SHA1。就我而言,我的电脑上有两个不同的

debug.keystore
文件。

一个位于

C:\User\myUser\.android
,另一个位于我的
android-sdk\.android
目录

我使用 Eclipse,在我的例子中,

debug.keystore
是从
android-sdk
目录中使用的。

如果您使用的是 Eclipse,您可以在

debug.keystore
处检查
Window/Preferences/Android/Build/
的位置。


0
投票

以上都不适合我。

如果您的 GoogleSignInOptions 无效,您将收到此错误,这是我的问题。

例如:

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).
        requestServerAuthCode("AN INVALID CLIENT ID").
        build();

也会给出同样的错误。


0
投票

仅适用于最终到达这里的其他人...对于我正在测试的未发布的应用程序,我还必须确保用于连接到我的设备上的 Play Games 的用户是

Google Cloud Console > APIs and Services > OAuth consent screen > Test Users
部分中的注册测试人员.

https://console.cloud.google.com/apis/credentials/consent

© www.soinside.com 2019 - 2024. All rights reserved.