Android-Firebase身份验证失败 [英] Android - Firebase Auth Failure

查看:183
本文介绍了Android-Firebase身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的应用程序. 我在下面的文档中使用了Firebase Auth. https://firebase.google.com/docs/auth/android/firebaseui?authuser = 0#top_of_page

I am developing a simple app. I used Firebase Auth following below document. https://firebase.google.com/docs/auth/android/firebaseui?authuser=0#top_of_page

在调试模式下,它可以正常工作. 在发布模式下,我创建一个Apk文件并直接安装,它也可以正常工作.

In debug mode, it works fine. In release mode, I create an Apk file, and install it directly, and it works fine too.

但是当我将其发布到PlayStore中并下载后,它失败了.

But when I released it into the PlayStore, and download it then it failed.

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
    super.onActivityResult(requestCode, resultCode, data)

    if (requestCode == RC_SIGN_IN) {
        val response = IdpResponse.fromResultIntent(data)

        if (resultCode == Activity.RESULT_OK) {
            val user = FirebaseAuth.getInstance().currentUser
            info("onActivityResult - ${user!!.email}")
            mPresenter.isAlreadyExistUser(user!!.email!!)
        } else {
            error("signIn failed - ${response!!.error}")  <-- Only when I downloaded it from playstore, it failed...
            response!!.error!!.printStackTrace()
        }
    }
}

W/System.err: com.firebase.ui.auth.FirebaseUiException: Code: 12500, message: 12500: 
W/System.err:     at com.firebase.ui.auth.data.remote.GoogleSignInHandler.onActivityResult(GoogleSignInHandler.java:106)
W/System.err:     at com.firebase.ui.auth.ui.idp.SingleSignInActivity.onActivityResult(SingleSignInActivity.java:121)

我试图找到错误代码12500,但我找不到. 怎么了?!

I tried to find the Error code 12500, but I cannot. What happened?!

我在gradle中执行了"signinReport",然后添加了调试并将SHA-1发行到Firebase中.

I executed "signinReport" in gradle, and I added the debug and release SHA-1 into the Firebase.

然后我下载了"google-services.json".

And then I downloaded the "google-services.json".

我要再说一次,它在调试apk和发行apk中都可以正常工作. 但是,当我将运行良好的发行版apk上传到PlayStore时,失败了.

I am telling again, it works fine in debug apk and release apk. But when I upload the working fine release apk into the PlayStore, it failed.

我真的不知道...

推荐答案

Google验证您的签名,删除该签名,并处理该捆绑包以生成基本APK,配置APK和动态功能APK(如果适用) .谷歌重新签署了APK.因此,您必须在Firebase控制台中为您的应用添加新的SHA-1标志. 打开 Google Play控制台

Google verifies your signature, removes the signature, and processes the bundle to generate a base APK, configuration APK(s), and dynamic feature APKs (if applicable). And Google re-signs the APKs. So you have to add new SHA-1 sign for your app in Firebase console. Open Google Play Console

选择发布管理 应用签名

使用提供的 SHA-1 作为Firebase.

Use the provided SHA-1 for firebase.

这篇关于Android-Firebase身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆