Google Play游戏服务无法登录

加文

几天来,我一直在用头撞墙。尽管阅读了许多描述了GPS登录失败的众多问题/解决方案的文章,但我一直无法找到解决问题的方法。

简而言之,我正在使用LibGDX框架在Android Studio中开发游戏,并已将BaseGameUtils添加为库,并添加了所有必要的依赖项等。

问题陈述:游戏开始时,它尝试连接到GPGS,但始终以“无法登录”消息作为响应。日志猫包含以下消息:

01-03 19:37:41.744 6693-7436/? E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
01-03 19:37:41.764 20609-20609/? I/SignInActivity: Transition from 6 to 11
01-03 19:37:41.764 20609-20609/? W/SignInActivity: onSignInFailed()...
01-03 19:37:41.764 20609-20609/? W/SignInActivity: Sign in failed during 6
01-03 19:37:41.764 20609-20609/? W/SignInActivity: ==> Returning non-OK result: 10002

根据https://developers.google.com/android/reference/com/google/android/gms/games/GamesActivityResultCodes ...

public static final int RESULT_SIGN_IN_FAILED

Result code sent back to the calling Activity when signing in fails.

The attempt to sign in to the Games service failed.
For example, this might happen if the network is flaky,
or the user's account has been disabled, or consent could not be obtained.

Constant Value: 10002

我的网络不是“不稳定”的,我不认为自己的帐户已被禁用-我安装的其他商业游戏在GPGS上运行正常。

我已经对我的APK进行了签名-调试和发布(尽管我目前仅在调试状态下使用)。我已将游戏添加到Google Developer Console中,并在API Manager中将其链接,并创建了OAuth2客户端ID。实际上,我已经做了很多次,删除链接的游戏并以我的客户ID或SHA1指纹不正确的方式重新创建它。logcat消息表明OAuth2配置错误,但是我已经检查了很多次,对我来说一切都很好。验证签名的最佳方法是什么?

我正在物理三星S7上进行测试,可以直接从笔记本电脑上部署到该设备上。我的Android Gradle已声明了必要的SigningConfigs,因此我认为应该正确签名我部署的游戏。

android {
signingConfigs {
    config {
        keyAlias 'mygame-key'
        keyPassword 'mypassword'
        storeFile file('path/to/my/keystore.jks')
        storePassword 'keystorepassword'
    }
}
buildTypes {
    release {
        signingConfig signingConfigs.config
    }
    debug {
        signingConfig signingConfigs.config
        debuggable true
    }
}

在清单中,我有必要的行。例如-

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id"/>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>

最初,我在AndroidLauncher中使用GameHelper类,但最近发现它已被弃用,因此我将代码更改为使用GoogleApiClient。构建器的定义如下:

mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Games.API).addScope(Games.SCOPE_GAMES)
            .build();

其他方法的代码直接取自TrivialQuest示例应用程序,例如-

@Override
protected void onStart() {
    Log.d(TAG, "onStart()");
    super.onStart();
    mGoogleApiClient.connect();
}

但是,尽管使用了Google API客户端代码,但这没有什么区别。

我不确定这里还可以提供什么,但是如果您需要查看代码的任何其他部分,请告诉我。对于代码或日志中要检查的事情的任何建议,以获取有关失败原因的更好线索,我将万分感谢。

提前谢谢了。

MatPag

我认为您应该仔细阅读(或重新阅读)这里描述的所有过程再次从头开始阅读本教程后,如果您需要更多帮助,请添加评论。

90%的问题与以下原因有关:SHA1签名证书错误,应用程序包名称错误,客户端ID丢失以及类似的问题...

PS:在这里您可以找到所有工作示例

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

“无法登录” Google Play游戏服务

Google Play游戏服务无法登录-返回已取消

无法登录到Google游戏服务

Android Google Play游戏服务登录失败并循环播放

Android Google Play游戏服务

Google Play游戏服务BaseGameUtils错误

Google Play游戏服务“已保存的游戏API”数据无法同步到其他设备

登录/重试失败时出现Google Play游戏服务怪异现象(活动生命周期)

Google Play游戏服务检查用户是否已登录Unity3d

Google Play游戏服务-无法提交下次活动的分数

Google Play游戏服务VS Google云端硬盘

LibGDX:如何实施Google Play游戏服务?

Google Play游戏服务错误代码400

使用Apache Cordova的本机Google Play游戏服务?

Google Play 游戏服务 createAutoMatchCriteria MIN_OPPONENTS > 1

导入Google Play游戏服务的Unity,依赖项错误

从Google Play注销游戏服务排行榜屏幕

Google Play游戏服务提醒:“检测到错误的实现”

在Swift中实施Google Play游戏服务

iOS上的Google Play游戏服务出现错误

如何实施Google Play游戏服务,Intellij,libgdx

Unity Admob与Google Play游戏服务集成

Google Play游戏服务:调试和发布证书

Google Play游戏服务在线保存数据

使用Google Play游戏服务联系用户

Google Play游戏服务| ShowSelectSavedGameUI Unity Android

Google Play游戏服务包名称可能存在错误?

Google游戏服务信息

无法使用App Signing对开发人员构建的Google Play游戏服务进行身份验证