I'm working on an app in Android studio that is using Google Play Games services for achievements and leaderboards, but I'm getting the error while trying to sign in. I followed the documentation, all my keys and OAuth codes are matching and still I am getting this error when I try to sign in:
com.google.android.gms.common.api.ApiException: 4: 4:
I looked everywhere for an answer, restarted all the credentials, unpublished and then published all new stuff needed, checked all the IDs. If anyone could give me some advice on what else to try ill be really grateful.
com.google.android.gms.common.api.ApiException: 4: 4:
at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
at com.google.android.gms.common.internal.zai.zaf(Unknown Source)
at com.google.android.gms.common.internal.zaj.onComplete(Unknown Source)
at com.google.android.gms.common.api.internal.BasePendingResult.zaa(Unknown Source)
at com.google.android.gms.common.api.internal.BasePendingResult.setResult(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzj.zzc(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzt.dispatchTransaction(Unknown Source)
at com.google.android.gms.internal.auth-api.zzd.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:461)
This is the code used from Google docs for sign-in.
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()) {
message = getString(R.string.signin_other_error);
}
new AlertDialog.Builder(this)
.setMessage(message)
.setNeutralButton(android.R.string.ok, null)
.show();
}
}
}