尝试在android中登录Google游戏服务时出现错误403 [英] Error 403 when trying to sign in to Google Game Services in android
问题描述
我正在尝试使用Google Android SDK接收消息,但出现很多错误...
我看到了有关此错误和所有其他错误的所有文章,但仍然无法弄清楚。
我检查了SH1,Google API,已链接我的应用程序,检查了app_id。
I'm trying to Sing In using Google Android SDK and I get A lot of errors... I saw all the post about this and any other errors and still can't figure this out. I check SH1, Google APIs, Linked my app, checked app_id.
这是我的代码:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_PROFILE)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.build();
@Override
public void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
@Override
public void onConnected(Bundle bundle) {
System.out.println("Logged in");
}
@Override
public void onConnectionSuspended(int i) {
mGoogleApiClient.connect();
}
@Override
public void onConnectionFailed(ConnectionResult result) {
if (!mIntentInProgress && result.hasResolution()) {
try {
mIntentInProgress = true;
startIntentSenderForResult(result.getResolution().getIntentSender(),
RC_SIGN_IN, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
// The intent was canceled before it was sent. Return to the default
// state and attempt to connect to get an updated ConnectionResult.
mIntentInProgress = false;
mGoogleApiClient.connect();
}
}
}
@Override
public void onActivityResult(int requestCode, int responseCode, Intent intent) {
super.onActivityResult(requestCode, requestCode, intent);
if (requestCode == RC_SIGN_IN) {
mIntentInProgress = false;
if (!mGoogleApiClient.isConnecting()) {
mGoogleApiClient.connect();
}
}
}
@Override
public boolean isSignedIn() {
return (mGoogleApiClient != null && mGoogleApiClient.isConnected());
}
我得到的错误:
02-21 10:07:18.920 11247-11712 / com.google.android.gms E / Volley:[937]
aa:$ b意外响应代码403 $ b https://www.googleapis.com/games/v1/players / me?language = zh_CN 02-21
10:07:18.980 11247-17039 / com.google.android.gms
E / SignInIntentService:访问权限未配置。您的专案未启用API(Google Play
游戏服务API)。请使用
Google Developers Console更新您的配置。
com.google.android.gms.games.hca
在com.google.android.gms.games.hba(SourceFile:153)
在com.google.android.gms.games .a.bj.d(SourceFile:1683)
在com.google.android.gms.games.a.bj.b(SourceFile:610)
在com.google.android.gms.games .a.bj.b(SourceFile:585)
在com.google.android.gms.games.atd(SourceFile:824)
在com.google.android.gms.games.service.wb (SourceFile:347)com.google.android.gms.games.service.sa上的
(SourceFile:47)com.google.android.gms.games.service.GamesSignInIntentService.onHandleIntent(SourceFile :499)android.app.IntentService $ ServiceHandler.handleMessage(IntentService.java:65)
android.os.Handler.dispatchMessage(Handler.java:102)
在android。 os.Looper.loop(Looper.java:136)
在android.os.HandlerThread.run(HandlerThread.java:61)02 -21 10:07:18.985 17012-17012 / com.google.android.gms.ui
E / LoadSelfFragment:无法登录-应用程序没有
注册的客户端ID
02-21 10:07:18.920 11247-11712/com.google.android.gms E/Volley﹕ [937] a.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/me?language=en_US 02-21 10:07:18.980 11247-17039/com.google.android.gms E/SignInIntentService﹕ Access Not Configured. The API (Google Play Game Services API) is not enabled for your project. Please use the Google Developers Console to update your configuration. com.google.android.gms.games.h.c.a at com.google.android.gms.games.h.b.a(SourceFile:153) at com.google.android.gms.games.a.bj.d(SourceFile:1683) at com.google.android.gms.games.a.bj.b(SourceFile:610) at com.google.android.gms.games.a.bj.b(SourceFile:585) at com.google.android.gms.games.a.t.d(SourceFile:824) at com.google.android.gms.games.service.w.b(SourceFile:347) at com.google.android.gms.games.service.s.a(SourceFile:47) at com.google.android.gms.games.service.GamesSignInIntentService.onHandleIntent(SourceFile:499) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61) 02-21 10:07:18.985 17012-17012/com.google.android.gms.ui E/LoadSelfFragment﹕ Unable to sign in - application does not have a registered client ID
我也陷入了 onActivityResult
和 onConnectionFailed
。我在 onConnectionFailed
中得到的错误代码是4。
I also stuck in loop that goes between onActivityResult
and onConnectionFailed
. The error code that I get in onConnectionFailed
is 4.
任何人都知道这可能是什么吗?
Any one knows what could it be?
推荐答案
我找到了解决方案:
我用错误的SHA1链接了我的应用程序...我使用了一些自定义键或类似的东西那。我试图在我的设备上调试它,但是它不起作用。
I found the solution: I linked my app with the wrong SHA1... I used some custom key or something like that. I tried to debug it on my device and it didn't work.
解决方案是从位于此处的调试键->
The solution was to extract SHA1 from the debug key that located here ->
C:\Users\.android\debug.keystore
C:\Users\.android\debug.keystore
,然后将我的应用与其链接。
and then link my app with it.
这篇关于尝试在android中登录Google游戏服务时出现错误403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!