生成APK文件后Flutter / Firebase Google登录不起作用 [英] Flutter/Firebase Google login not working after building apk file

查看:125
本文介绍了生成APK文件后Flutter / Firebase Google登录不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了使用firebase和google_sign的android应用。然后我通过flutter build apk释放了apk。但是在我的手机上本地安装了该apk文件后,尽管我运行良好,但google登录页面无法正常工作。



我知道,在将应用发布到Playstore时,我们需要添加提供的SHA1密钥,但是如果我不打算发布到Google Play,那么有什么方法可以使

解决方案

这是一个较晚的答案,但是您在本地计算机上使用的调试甚至prod签名密钥如果您使用AppBundle或Google App签名(除非您选择退出,否则这是现在的规范),否则创建APK无效。



用于生产应用转到Google Play控制台。单击您的应用程序,然后单击发布管理->应用程序签名。然后在应用程序签名证书下查看,您可以在项目设置-> SHA证书指纹下将SHA1复制到Firebase控制台。



这是因为当您上传APK / AppBundle时,您的上传密钥会在Google服务器上换出。这意味着您从Play商店向用户提供的生产应用具有的SHA1指纹与本地计算机上的任何其他SHA1指纹(包括您的签名密钥)都不相同,这就是为什么它们在上线时不起作用,而在本地调试时起作用的原因。 b

I have made android app that uses firebase and google_sign. Then I have release apk by flutter build apk. But after installing that apk file locally in my phone the google login page does't works although I works perfectly.

I am aware that when publishing the app to playstore we need to add provided SHA1 key but if I am not planing to release to google play then is there any way to make with work?

解决方案

This is a late answer, but the debug and even the prod signing key that you use on your local machine to create the APK won't work if you use AppBundle or Google App Signing (which is the norm now unless you opt out).

For Production apps go to Google Play Console. Click your app, click Release Management -> App Signing. Then look under App signing certificate here you can copy the SHA1 to your firebase console under Project Settings -> SHA certificate fingerprints.

This is because your upload key is swapped out on the google servers when you upload your APK / AppBundle. Meaning that your production app served to users from the play store has a different SHA1 fingerprint than anything on your local machine (including your signing keys) thats why they dont work when going live but work while debugging locally.

这篇关于生成APK文件后Flutter / Firebase Google登录不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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