Google Play 游戏服务 UNREGISTERED_ON_API_CONSOLE

Google Play Games Services UNREGISTERED_ON_API_CONSOLE

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

截图: View post on imgur.com

出现次数如下:
1.连接到游戏
2. GOOGLE PLAY GAMES window 弹出并消失(上图)
3.加载圈出现后消失


我 运行 adb logcat 在我的 phone 上,下面是我认为是问题所在区域的片段:

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 时使用的代码完全相同(调试 yes/no 除外):

    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 多个小时。

非常感谢您的宝贵时间!

首先去 google play console .. select 你的应用程序 .. 然后去发布管理下的应用程序签名。你会在这里找到两个证书。 1.应用签名证书 2.上传证书 从这里开始,您将需要对 SHA-1 certificate.copy 进行签名的应用程序。 现在转到 google api 控制台。您会在那里 select 找到您的游戏。你会发现这里的sha1和你上传证书的sha1是一样的。但您需要在此处粘贴您的签名 sha1 证书。你会一切顺利。希望对你有帮助。

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

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

  1. 检查您应用的 SHA1。记下这个。

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

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

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

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

    1. 转到 Play 控制台 (https://play.google.com/apps/publish/)
    2. 转到 "Games Services" 部分。
    3. Select你的游戏。
    4. 转到 "Games Details" 页面并滚动到底部。
    5. 它应该说 "API Console project" 并且有一个 link - 单击它。根据您的访问级别,您可能需要额外的帐户权限。
    6. 在“控制台项目”页面上单击 "Credentials"。
  4. 进入凭据控制台后,您应该会在 "OAuth 2.0 client IDs" 下看到您的应用。点击应用名称。

  5. 它将向您显示该客户端 ID 的 SHA1。如果它与之前的 SHA1 不匹配,那么您可以添加一个额外的客户端 ID。
  6. 在 Credentials 页面点击 'Create Credentials' -> 'OAuth Client ID',select 你的平台(Android 是我的),给它起个名字,输入你在步骤中的 SHA1 1/2 和您的应用程序包名称,然后按 'Create'
  7. 现在您的应用应该可以运行并能够连接到 Google Play 游戏服务。

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