Google Play 游戏服务 UNREGISTERED_ON_API_CONSOLE

Posted

技术标签:

【中文标题】Google Play 游戏服务 UNREGISTERED_ON_API_CONSOLE【英文标题】:Google Play Games Services UNREGISTERED_ON_API_CONSOLE 【发布时间】:2017-09-27 21:43:11 【问题描述】:

我在使用 Unity 开发的游戏中遇到 GPGS 无法验证的问题。

截图: View post on imgur.com

出现的情况如下: 1.连接游戏 2. GOOGLE PLAY GAMES 窗口弹出和消失(上图) 3. 加载圈出现然后消失

我在手机上运行了 adb logcat,下面是我认为问题所在区域的 sn-p:

04-30 09:45:10.023 11290 11316 W Unity   :  
04-30 09:45:10.023 11290 11316 W Unity   : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
04-30 09:45:10.023 11290 11316 W Unity   : 
04-30 09:45:10.044  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.058  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.065  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.073  3470 11371 V AccountUtils: 0 accounts found with uca feature
04-30 09:45:10.081  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.124  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.126  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.270  2097  2892 I BroadcastQueue: am_broadcast_enqueue: [background,0,Intent  act=com.facebook.messages.ipc.peersPROD flg=0x10 (has extras) ,2]
04-30 09:45:10.270  2097  2141 I BroadcastQueue: am_broadcast_finished: [background,0,Intent  act=com.facebook.messages.ipc.peersPROD flg=0x10 (has extras) ]
04-30 09:45:10.276 20864 21291 W Auth    : [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.282  3470 27320 E TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.294  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.301  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.302 11290 11290 V GamesNativeSDK: Play Games callback indicates connection failure.
04-30 09:45:10.302 11290 11368 I GamesNativeSDK: UI interaction required to connect to Google Play.
04-30 09:45:10.339 11290 11368 I GamesNativeSDK: Auth operation started: SIGN IN
04-30 09:45:10.339 11290 11368 I GamesNativeSDK: Connecting to Google Play...
04-30 09:45:10.346  3470  7470 W GamesServiceBroker: Client connected with SDK 10084000, Services 10298448, and Games 39080048
04-30 09:45:10.358  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.366  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.373  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.383  3470 11371 V AccountUtils: 0 accounts found with uca feature
04-30 09:45:10.391  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.410  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.427  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.517 20864 10927 W Auth    : [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.518  3470 27320 E TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.545  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.547  2097  2171 I art     : Starting a blocking GC Explicit
04-30 09:45:10.548  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.550 11290 11290 V GamesNativeSDK: Play Games callback indicates connection failure.
04-30 09:45:10.550 11290 11368 I GamesNativeSDK: UI interaction required to connect to Google Play.
04-30 09:45:10.550 11290 11368 I GamesNativeSDK: Resolving connection.

从上面的 logcat 看来,该游戏已在 API 控制台中取消注册。我看到了这个答案here 并在开发者控制台和 API 控制台上检查了我的 OAuth2 客户端 ID,它们是相同的。我也在使用测试人员帐户。

让我烦恼的是我去年开发的游戏没有问题(使用 Unity 5.4.2 和 GPGS 版本 0.9.35)但我目前正在做的游戏正在经历这个问题(使用 Unity 5.6 和 GPGS 版本 0.9.36),并且我真的不想因此而推迟日程。

网上有人建议将 SDK Tools 和 Google Repository 更新到最新版本,但这只是让 Unity 无法列出 sdk 版本。我不得不将 SDK Tools 降级到 25.2.5,将 Google Repo 降级到 41.0.0。

我尝试将 GPGS35 导入到项目中,这会导致构建错误,并且最新版本(GPGS37)已损坏。我还将该项目降级为 Unity 5.4.2,结果是灾难性的。

我不确定这是否与问题有关,因为这与我在之前的游戏中用于初始化 GPGS 的代码完全相同(调试是/否除外):

    void Start () 
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder ()
            .EnableSavedGames ()
            .Build ();

        PlayGamesPlatform.InitializeInstance (config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate ();
    

    public static void Login () 
        Social.localUser.Authenticate ((bool success) => 
            if (success) 
                MenuManager.instance.gpgsDebugText.text = "yes";
            
            else 
                MenuManager.instance.gpgsDebugText.text = MenuManager.instance.gpgsDebugText.text + "no";
            
        );
    

我希望有人能够回答,当游戏距离完成仅一步之遥时,这很烦人,并且试图解决这个问题已经浪费了 20 多个小时。

非常感谢您的宝贵时间!

【问题讨论】:

【参考方案1】:

首先去谷歌播放控制台..选择你的应用..然后去发布管理下的应用签名。你会在这里找到两个证书。 1.应用签名证书 2.上传证书 从这里您将需要应用签名 SHA-1 证书。复制它。 现在转到 google api 控制台。你会发现你的游戏在那里选择它。你会发现这里的sha1和你上传证书的sha1是一样的。但您需要在此处粘贴您的签名 sha1 证书。一切都会好起来的。希望它会有所帮助。

【讨论】:

我没有意识到 SHA1 有两个地方...感谢您的帮助!【参考方案2】:

我遇到这个问题是因为我的应用和服务的 SHA1 不同。对我来说,只有当我的应用程序在商店上线并影响我的本地开发版本时,这才成为一个问题。值得注意的是,我们的应用程序使用了应用程序签名功能,因此您有一个上传密钥和一个应用程序签名密钥。这些是我找到并编译成列表的各种说明。

我必须获取用于开发的密钥库的 SHA1,并将其添加到 Google API 控制台的凭据部分。

    检查应用的 SHA1。记下这一点。

    keytool -list -printcert -jarfile <apkfile.apk>

    检查您用于签署应用程序的密钥库的 SHA1。为此,您将需要您的密钥库密码。也记下这一点。这应该与上一步中的 SHA1 匹配。

    keytool -exportcert -alias <youralias> -keystore <path-to-keystore> -list -v

    转到您的 Google Play 游戏服务应用的 Google API 控制台。这是到达那里的方法。

      转到 Play 控制台 (https://play.google.com/apps/publish/) 转到“游戏服务”部分。 选择您的游戏。 转到“游戏详情”页面并滚动到底部。 它应该显示“API 控制台项目”并有一个链接 - 单击此链接。根据您的访问级别,您可能需要额外的帐户权限。 在控制台项目页面上单击“凭据”。

    一旦在凭据控制台上,您应该会在“OAuth 2.0 客户端 ID”下看到您的应用程序。点击应用名称。

    它将显示该客户端 ID 的 SHA1。如果它与您之前的 SHA1 不匹配,那么您可以添加一个额外的客户端 ID。 在凭据页面上单击“创建凭据”->“OAuth 客户端 ID”,选择您的平台(android 是我的),为其命名,输入第 1/2 步中的 SHA1 和应用程序的包名称,然后按“创建”

    现在您的应用应该可以运行并且能够连接到 Google Play 游戏服务了。

    希望这对其他人有所帮助,因为我花了好几个小时才让它工作。

【讨论】:

嗯,我的 SHA1 与那个相同,但我仍然收到错误:NOT_AUTHORIZED @kantagara - 我在使用 Unity 时再次遇到了这个问题。我正在构建 apk 的开发版本,它以不同的方式对其进行签名。这意味着 APK 的 SHA1 不同。检查 APK 的 SHA1 并检查它是否匹配 - 方法如下:***.com/questions/11331469/…

以上是关于Google Play 游戏服务 UNREGISTERED_ON_API_CONSOLE的主要内容,如果未能解决你的问题,请参考以下文章

Google Play 游戏服务 - 无法登录游戏中心

Android Google Play 游戏服务回合制多人游戏不自动匹配

java - Google Play 游戏服务

Android 模拟器上的 Google Play 服务和 Google Play 游戏应用

Google Play 游戏服务实时多人游戏停止工作

使用“Google Play 游戏服务”玩游戏时突然断开连接