我想在我的应用程序中使用谷歌游戏,我正在尝试登录谷歌游戏,但我总是收到错误 ERROR 12501
。
我尝试登录到谷歌并成功,但不是谷歌游戏。
GoogleSignInClient signInClient = GoogleSignIn.getClient(this,
GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
Intent intent = signInClient.getSignInIntent();
startActivityForResult(intent, 9003);
if (requestCode == 9003) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
GoogleSignInAccount signedInAccount = result.getSignInAccount();
Log.d("debug", "logged");
} else {
String message = result.getStatus().getStatusMessage();
if (message == null || message.isEmpty()) {
message = "Error" +result.getStatus().getStatusCode();
}
new AlertDialog.Builder(this).setMessage(message)
.setNeutralButton(android.R.string.ok, null).show();
}
}
这是我的代码,我几乎没有从这里更改任何东西 Sign-in in Android Games .
关于我的 key ,所以我尝试了很多配置但没有任何效果。
我用我的应用程序 ID 添加了这段代码
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="MY_APP_ID_HERE_12_DIGITS_NUM" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
This is my OAuth2 clients ids - web, release and debug
我也试过只发布或只调试 key 但没有成功...
My firebase configuration
SHA1 I use in release Oauth2 - From google play signin
SHA1 I use in debug OAuth2 - From android studio Gradle SigningReport
请帮助我,我真的很沮丧,我认为问题出在我的 OAuth2 key 上,但我无法弄清楚它是什么。
最佳答案
好吧,我想通了,这是一个愚蠢的错误,但我决定分享。
因此,要启动 Google 游戏,您需要 2 行 -(带有您的 App Id 12 位数字...)
<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"/>
并且您需要将它们添加到 mainfest.xml
中在 <application>
我在 <mainfest>
中添加了这些行...(错误!!)
希望对大家有帮助
关于android - Google 游戏登录 - 错误 12501 无效响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49828599/