我在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完全相同的代码(调试是/否除外):
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多个小时 .
非常感谢您的宝贵时间!
2 回答
首先去谷歌播放控制台..选择你的应用程序..并转到发布管理下的应用程序签名 . 你会在这里找到两个证书 . 1. app签名证书2.从这里上传证书你需要签署SHA-1证书的应用程序 . 现在去google api console . 你会发现你的游戏选择它 . 你会发现这里的sha1与你上传证书的sha1相同 . 但是你需要在这里粘贴你的签名sha1证书 . 你会很高兴去的 . 希望它会有所帮助 .
我有这个问题,因为我的应用程序和服务的SHA1是不同的 . 对我来说,这只是一个问题,一旦我的应用程序在商店上线并影响我的本地开发版本 . 值得注意的是,我们的应用程序使用应用程序签名功能,因此您拥有上传密钥和应用程序签名密钥 . 这些是我发现并编译成列表的各种指令 .
我必须得到我用于开发的密钥库的SHA1,并将其添加到Google API控制台的凭据部分 .
keytool -list -printcert -jarfile <apkfile.apk>
keytool -exportcert -alias <youralias> -keystore <path-to-keystore> -list -v
转到Google Play游戏服务应用的Google API控制台 . 这是如何到达那里 .
转到Play控制台(https://play.google.com/apps/publish/)
转到"Games Services"部分 .
选择你的游戏 .
转到"Games Details"页面并滚动到底部 .
应该说"API Console project"并有一个链接 - 点击这个 . 您可能需要其他帐户权限,具体取决于您的访问级别 .
在“控制台项目”页面上,单击"Credentials" .
在凭据控制台上,您应该会在“OAuth 2.0客户端ID”下看到您的应用 . 单击应用程序名称 .
它将显示该客户端ID的SHA1 . 如果它与之前的SHA1不匹配,则可以添加其他客户端ID .
在凭据页面上单击'Create Credentials' - > 'OAuth Client ID',选择您的平台(Android是我的),为其命名,从步骤1/2输入您的SHA1以及您的应用程序的包名称,然后按'Create'
现在您的应用应该可以使用并能够连接到Google Play游戏服务 .
希望这可以帮助别人,因为它花了我几个小时才能让它工作 .