Google登录游戏失败

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

[请,我需要帮助,因为确定它很傻,但是我有点被卡住了。我在Play商店中已经有一个运行正常的android游戏,但是我想合并一个排行榜,为此,我需要用户输入其Google游戏的google用户名。我已经阅读了很多次手册,并且肯定缺少某些内容。为了给您提供一些背景信息,该游戏已经在playstore中发布,该游戏也与playgame相关联,leaderboaard在google游戏中创建,该游戏链接到firebase,并且我创建了api。 (我会说一切都做得很好)。我还合并了.json。我正在以调试模式在Android Studio的仿真器中对其进行测试。如果使用此代码,则会出现以下错误:

 GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken("My id client")
            .requestScopes(Games.SCOPE_GAMES_LITE)
            .build();
    mGoogleSignInClient = GoogleSignIn.getClient(MainActivity.this, gso);

2020-04-07 12:40:52.641 11274-12521 /? 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         : info_hiden
**** Cert SHA1 fingerprint: info_hiden
**** App ID from manifest : info_hiden
****
**** 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

[当我说“我的客户编号时,我是从这里得到的:

Client ID

这是正确的吗?我应该检查更多东西吗?顺便说一句,我确实在清单中有游戏的ID,并且我在gradle中实现了所有内容。

我应该在firebase中做些其他事情吗?老实说,我什至不知道什么是firebase。

啊,如果我放上一个代码,但是没有IdToken行,我可以毫无问题地输入我的google用户到应用程序,只有在此之后,它才能让我在排行榜上不显示任何内容,因为它告诉我没有关联的客户端而且钥匙不见了,我猜这是正常的。据我了解,钥匙一定有问题。是这样吗?

非常感谢您的帮助!

**编辑:

我正在尝试使用此ID:

Client ID new

而且似乎可以很好地登录,但我有此日志:

2020-04-07 18:22:24.550 1658-2174/? W/AppOps: Bad call: specified package com.google.android.play.games under uid 10013 but it is really 10156
    java.lang.RuntimeException: here
        at com.android.server.AppOpsService.getOpsRawLocked(AppOpsService.java:1257)
        at com.android.server.AppOpsService.checkPackage(AppOpsService.java:976)
        at com.android.internal.app.IAppOpsService$Stub.onTransact(IAppOpsService.java:169)
        at android.os.Binder.execTransact(Binder.java:565)
2020-04-07 18:22:24.564 26592-26592/? W/ChimeraUtils: Non Chimera context
2020-04-07 18:22:24.586 26592-26651/? W/GLSUser: [DeviceKeyStore] Cannot load key: Device key file not found.
2020-04-07 18:22:24.596 11274-11371/? W/GamesServiceBroker: Client connected with SDK 201000000, Services 200914022, and Games 168400078

和:

2020-04-07 18:22:24.781 26592-26651/? W/GLSUser: [AppCertManager] IOException while requesting key: 
    java.io.IOException: Invalid device key response.
        at ipd.a(:com.google.android.gms@[email protected] (040700-300565878):46)
        at ipb.a(:com.google.android.gms@[email protected] (040700-300565878):5)
        at ipb.a(:com.google.android.gms@[email protected] (040700-300565878):42)
        at clb.onTransact(:com.google.android.gms@[email protected] (040700-300565878):6)
        at android.os.Binder.transact(Binder.java:499)
        at dtz.onTransact(:com.google.android.gms@[email protected] (040700-300565878):2)
        at android.os.Binder.transact(Binder.java:499)
        at aaml.onTransact(:com.google.android.gms@[email protected] (040700-300565878):26)
        at android.os.Binder.execTransact(Binder.java:565)
2020-04-07 18:22:24.781 26592-26651/? W/GLSUser: [DeviceKeyStore] Cannot load key: Device key file not found.

和:

2020-04-07 18:22:25.153 11274-11365/? E/Volley: [18347] BasicNetwork.performRequest: Unexpected response code 401 for https://www.googleapis.com/games/v1/applications/played
2020-04-07 18:22:25.165 11274-23833/? W/GameAgent: Volley error when reporting played
    com.android.volley.AuthFailureError
        at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@[email protected] (040700-300565878):37)
        at stl.performRequest(:com.google.android.gms@[email protected] (040700-300565878):14)
        at com.android.volley.NetworkDispatcher.a(:com.google.android.gms@[email protected] (040700-300565878):6)
        at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@[email protected] (040700-300565878):2)

有什么想法吗?

谢谢!

android game-engine google-signin
1个回答
0
投票

如果您的目标只是简单地登录Google Play游戏服务,则应指定GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN,并且应该不是请求范围或真实ID令牌。 (请参见https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInOptions

关于游戏服务配置问题,最可能的问题是,如错误消息所言,是由这三个原因之一引起的(这又导致以后的游戏API请求出现身份验证问题)。 (有关详细信息,请参见https://developers.google.com/games/services/console/enabling#avoiding_common_setup_problems。)

您显示的第一个客户ID图像似乎配置正确,所以让我们逐一分析每个组件。 (您链接的第二个客户端ID页不适用于Android应用,并且不会被Android上的Google Play游戏服务使用。)>

[首先,在Google Play开发者控制台中查看游戏的游戏服务页面。左侧边栏中的“链接的应用程序”和“测试”旁边应有一个绿色的复选标记。如果其中任何一个都不是绿色,请确保已使用OAuth客户端ID页上显示的相同程序包名称链接了该应用,并且已在测试页上保存了信息,等等。

确保“客户端ID”页面上列出的软件包名称与游戏的AndroidManifest.xml中的软件包名称相同(并与错误消息中列出的软件包名称匹配。)>

接下来,请确保您的游戏已正确签名。错误消息中的SHA-1指纹必须与“客户端ID”页面上显示的指纹匹配。请注意,如果您的应用程序签名是由Google Play管理的,则您可能无权访问用于对应用程序进行签名以从Google Play分发的密钥(取决于您在Google中设置应用程序的方式,该密钥可能与您的上传密钥不同播放)。

APP ID是指Google Play游戏应用程序ID(而不是完整的OAuth客户端ID)。在您的游戏的Google Play开发者控制台游戏服务页面上可以找到它。它是位于游戏服务页面上游戏标题正下方的12或13位数字,也是您突出显示的OAuth客户端ID的第一部分。 确保错误消息中列出的清单中的APP ID与开发者控制台中游戏的游戏服务页面上列出的编号相匹配。

如果应用ID完全丢失,请确保您游戏的AndroidManifest.xml包含[ C0]元素,用于在其<meta-data>部分中定义APP ID,并且该ID以<application>开头或包含在资源中。 (请参见\u003

最后,请确保您设备上的默认Google帐户已在您的应用程序“游戏服务”页面的“测试人员”部分中列出。在具有多个Google帐户的设备上,可以将其中一个设置为“自动登录受支持的游戏”。

希望这些事情之一可以识别问题。

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