gpt4 book ai didi

android - 我的 Google 登录在我的 Android 应用程序上运行良好,现在显示错误代码 "10"

转载 作者:行者123 更新时间:2023-12-02 13:12:22 39 4
gpt4 key购买 nike

我正在开发一个 Android 应用程序,Google 登录运行得很好。由于一些硬件问题,我不得不重新安装 Windows,之后当我尝试新的 APK 时,应用程序开始抛出错误,给出代码:10。

我尝试将新的 SHA-1 key 上传到 Firebase 控制台。我什至创建了一个虚拟应用程序,其中 Google Sign 运行良好。

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 个问题需要检查

  1. Google API 控制台中的 SHA1 和软件包名称
  2. 检查 GoogleSignInOptions
  3. 网络客户端 ID(如果您正在使用它)属于您注册软件包名称和 SHA1 的同一项目。

关于android - 我的 Google 登录在我的 Android 应用程序上运行良好,现在显示错误代码 "10",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55811238/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com