gpt4 book ai didi

java - 无法登录 Google Play 游戏服务 : Must have a game ID to sign in

转载 作者:行者123 更新时间:2023-11-30 12:03:39 25 4
gpt4 key购买 nike

我正在尝试集成 Google Play 游戏服务,但无法登录。我知道之前有一些开发人员询问过这个问题,但问题是没有人询问我遇到的错误。

日志是这样的

Must have a game ID to sign in!

Status{statusCode=unknown status code: 12501, resolution=null}

Invalid (empty) game ID found in the EXTRA_GAME_ID extra.

我只是按照官方文档上的教程进行操作。这个错误的原因可能是什么?似乎没有人问过这个错误,这很奇怪。每个人都有一些状态码,但我的只是 unknown有人遇到过这个错误吗?

代码

list

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="...">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:roundIcon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">

<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"/>
...

Activity

private void startSignInIntent() {
GoogleSignInClient signInClient = GoogleSignIn.getClient(this,
GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
Intent intent = signInClient.getSignInIntent();
startActivityForResult(intent, RC_SIGN_IN);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
// The signed in account is stored in the result.
GoogleSignInAccount signedInAccount = result.getSignInAccount();
} else {
String message = result.getStatus().getStatusMessage();
if (message == null || message.isEmpty()) {
Log.e("e", result.getStatus());
message = "Something wrong happened. Please try again.";
}
new AlertDialog.Builder(this, R.style.CustomAlertDialogTheme).setMessage(message)
.setNeutralButton(android.R.string.ok, null).show();
}
}
}

res/values/ids.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="app_id" type="string">digits here...</item>
</resources>

我确信我已将我的应用链接到 Play 游戏服务。我将自己添加到 Play 控制台(游戏服务部分以及发布管理)的测试人员中。我尝试了实际设备和模拟器。我没有在 API 控制台上手动创建 OAuth2 客户端 ID。我是从 Play 控制台创建的。 SHA-1 是正确的(如果这不正确,我应该会收到其他错误消息。)从未奏效。

最佳答案

我遇到了相同输出的问题 - 我将 com.google.android.gms:play-services-(base/games/auth) 的版本降级到 16.0.0 并获得了更好的错误日志:

019-10-24 11:52:03.266 25880-12410/? E/ValidateServiceOp: ****
**** APP ID IS NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
**** Specify it using @string resources value or \u003 followed by an app_id value.
**** For example:
**** meta-data android:name="com.google.android.gms.games.APP_ID"
**** android:value="@string/app_id" />
**** or
**** meta-data android:name="com.google.android.gms.games.APP_ID"
**** android:value="\u003123456789" />

我的 list 是这样的:

android:name="com.google.android.gms.games.APP_ID"
**** android:value="3123456789" />

我缺少 \u003 符号。在将其替换为 @string/app_id 并将值赋给 strings.xml 后,它开始工作了。您将此字符串添加到 ids.xml,这可能是错误的。

之后,我升级了 Google Play 服务的版本,一切正常!

关于java - 无法登录 Google Play 游戏服务 : Must have a game ID to sign in,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57535377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com