android - GoogleSignInClient 返回 8(内部错误)

标签 android google-play-services google-play-games


我正在尝试将我的游戏连接到 Google Play 游戏服务,但当我尝试登录时,它总是返回错误代码 8(内部错误)。
代码是从Google example:复制粘贴的

lateinit var signInClient: GoogleSignInClient

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.layout_settings)
    settings_login.setOnClickListener { login() }
    signInClient = GoogleSignIn.getClient(this,
            GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).build()
    )
}

private fun login() {
    startActivityForResult(signInClient.signInIntent, 9001)
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode != 9001) {
        return
    }

    val task = GoogleSignIn.getSignedInAccountFromIntent(intent)

    try {
        val account = task.getResult(ApiException::class.java)
        onConnected(account)
    } catch (apiException: ApiException) {
        var message: String? = apiException.message
        if (message == null || message.isEmpty()) {
            message = getString(R.string.signin_other_error)
        }

        onDisconnected()

        AlertDialog.Builder(this)
                .setMessage(message)
                .setNeutralButton(android.R.string.ok, null)
                .show()
    }
}

在 Google Play 控制台中,我已将我的游戏与调试 keystore SHA-1 相关联。 我已经检查了 Troubleshooting guide 中提到的所有内容,但我仍然一次又一次地收到此消息。
有人遇到过这个问题吗?有什么调试方法吗?
编辑:
我发现它实际上让我登录 - 如果我重新启动游戏,方法 signInSilently() 将会成功。但是,当我注销并尝试手动登录时,它仍然显示此错误 8。会不会是登录 Activity 覆盖的问题?
哦,我在 Google Play Api 控制台中检查了 api 访问权限 - 它显示 api 实际上收到了我的电话并且没有提到任何错误。 See screenshot
编辑 2:我已将 requestEmail() 添加到 GoogleSignInOptions.Builder,它向我显示了访问请求覆盖。但是,它仍然在 GoogleSignIn.getSignedInAccountFromIntent(intent).getResult(ApiException::class.java) 中失败并出现相同的错误(8 - 内部错误)。

最佳答案

在 Google Play Services 12.2.21 中看起来像这个错误:

https://github.com/googlesamples/google-services/issues/358

Google 应该会尽快修复以通过无线方式发布..

关于android - GoogleSignInClient 返回 8(内部错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49223941/

相关文章:

android - 实时多人游戏还是回合制多人游戏 API?

java - 如何从不同的类访问 boolean 值?

android - 如何在 Android 中更改我的 Gtalk 或 Gmail 的状态?

java - Google Play 游戏实时多人游戏 : How to get the participant id of the current user?

google-play - Google Play 游戏服务 - 隐藏/取消隐藏成就

memory-management - Google Play 服务在我的应用程序中消耗更多 RAM

java.lang.String 无法转换为 JSONObject,其中值已转换为 JSONObject

android - Awareness.SnapshotApi.getLocation 中的 onResult() 未从服务调用

android - 在 Android 中重复任务

android - java.lang.IllegalArgumentException : Component class com. google.android.gms.wallet.ocr.CardRecognitionShimProxyActivity