我正在开发一款Android应用,而且Google Sign In工作得非常好。由于一些硬件问题,我不得不重新安装Windows之后,当我尝试新的APK应用程序开始抛出错误给出代码:10。
我尝试将新的SHA-1密钥上传到Firebase控制台。我甚至创建了一个虚拟应用程序,其中谷歌标志工作正常。
private GoogleSignInClient mGoogleSignInClient; //globally defined
在onCreateMethod()我正在使用它
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
// [END config_signin]
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQ_CODE) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
//login="2";
// Signed in successfully, show authenticated UI.
//updateUI(account);
Log.i("Email", account.getEmail());
Log.i("Display Name", account.getDisplayName());
Log.i("First Name", account.getFamilyName());
Log.i("Given Name", account.getGivenName());
Log.i("Profile", account.getPhotoUrl().toString());
Log.i("Token", account.getId());
progressDialog.show();
final Thread t = new Thread() {
@Override
public void run() {
int jumpTime = 0;
while (jumpTime < totalprogressTime) {
try {
sleep(3000
);
jumpTime += 5;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
t.start();
GOOGLElogIn(account.getEmail(),"1",account.getDisplayName(),account.getIdToken(),logintype);
//,login,
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
// Please refer to the GoogleSignInStatusCodes class reference for more information.
Log.e("Google SignIn", "signInResult:failed code=" + e.getStatusCode());
//show toast
Toast.makeText(this, "Failed to do Sign In : " + e.getStatusCode(), Toast.LENGTH_SHORT).show();
//updateUI(null);
}
}
go.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isGuest=false;
logintype = "3";
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, REQ_CODE);
}
});
控制台日志显示此
D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=1110, firebase_screen_class(_sc)=LoginActivity, firebase_screen_id(_si)=4507256814460934916}]
V/FA: onActivityCreated
D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=LoginActivity, firebase_previous_id(_pi)=4507256814460934916, firebase_screen_class(_sc)=SignInHubActivity, firebase_screen_id(_si)=4507256814460934917}]
V/FA: Activity resumed, time: 620052166
Screen exposed for less than 1000 ms. Event not sent. time: 97
V/FA: Activity paused, time: 620052199
E/Google SignIn: signInResult:failed code=10
根据@IntelliJ Amiya github链接,它显示错误代码10是DEVELOPER_ERROR。
您需要检查3个问题