android – 错误:状态{statusCode = DEVELOPER_ERROR,resolution = null}
作者:互联网
我正在使用gplus登录,并且当我在onActivityResult时遇到此错误….
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
client.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
GoogleSignInAccount acct = result.getSignInAccount();
// Log.d("Result","details"+ acct.getDisplayName() + acct.getEmail());
mEmail = acct.getEmail();
String mFullName = acct.getDisplayName();
String mGoogleplusId = acct.getId();
SocialUser user = new SocialUser();
user.setType("googleplus");
user.setEmail(mEmail);
user.setFullname(mFullName);
user.setId(mGoogleplusId + "");
loginParams.put("email_id", mEmail);
loginParams.put("googlePlusId", mGoogleplusId);
loginParams.put("full_name", mFullName);
loginParams.put("registrationType", "googleplus");
SignUpService(user);
} else {
Toast.makeText(CustomerLogIn.this, "Unable to fetch data, Proceed manually", Toast.LENGTH_SHORT).show();
}
}
}
我要求按钮点击gplus登录.在按下代码后执行代码….
GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(CustomerLogIn.this)
.addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
.build();
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, 0);
而且我发现了这个错误……
Status{statusCode=DEVELOPER_ERROR, resolution=null}
在这条线上….
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
请建议解决方案.
解决方法:
您需要将SHA1密钥添加到firebase控制台配置.
你可以这样做:
Firebase控制台(https://console.firebase.google.com) – >你的项目 – >配置 – >滚动到
您可以在Android Studio中找到运行“登录报告”的SHA1密钥:
然后,查看“运行选项卡”并单击按钮:
我认为这是更简单的方法.希望这有帮助.
标签:android,google-plus 来源: https://codeday.me/bug/20190917/1809201.html