我在Unity中开发的游戏中没有验证GPGS的问题。
事件如下:
1.连接游戏
2. GOOGLE PLAY GAMES窗口弹出并消失(上图)
3.出现加载圈然后消失
我在手机上运行了adb logcat,下面是我觉得问题的区域片段:
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.
似乎游戏在API控制台中未注册,来自上面的logcat。我看到了这个答案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的代码完全相同(调试是/否除外):
< / p>
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多个小时。
非常感谢你的时间!
答案 0 :(得分:6)
首先去google play console ..选择你的应用..然后转到发布管理下的app签名。你会在这里找到两个证书。 1. app签名证书 2.上传证书 从这里你需要签署SHA-1证书的应用程序。 现在去google api console。你会发现你的游戏选择它。你会发现这里的sha1与你上传证书的sha1相同。但是你需要在这里粘贴你的签名sha1证书。你会很高兴去的。希望它会有所帮助。
答案 1 :(得分: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控制台。这是如何到达那里。
进入凭据控制台后,您应该会在&#34; OAuth 2.0客户端ID&#34;下看到您的应用。点击应用名称。
现在,您的应用应该可以使用并能够连接到Google Play游戏服务。
希望这对其他人有所帮助,因为我花了好几个小时让它运转起来。