发布Flutter应用后,Google登录无法正常运行 [英] Google sign in doesn't work after release of flutter app

查看:224
本文介绍了发布Flutter应用后,Google登录无法正常运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Flutter开发了一个应用,并使用以下命令在我的设备上进行了测试:

  flutter run --release 

一切正常。
我也尝试使用以下方式构建应用程序:

  flutter build apk --release 

并手动安装,仍然一切正常。

我在商店上载了,现在登录没有不再工作了。
我尝试查看logcat,尝试登录时遇到的错误是:

  I / flutter:例外:PlatformException(sign_in_failed,com.google.android.gms.common.api.ApiException:12500:,空)

我尝试添加appCompat依赖项,并检查了SHA1键,一切都在正确的位置,我无法弄清楚为什么当我从商店下载时不再起作用。

解决方案

您的应用可能没有针对令牌API的正确Google凭据。



首次登录Google Play控制台时,您可能选择了Google的应用签名服务。它的作用是,在您使用密钥库对应用程序进行签名并将其上传到Play控制台后,Google实际上会使用生成的密钥库对您的应用程序进行签名并推出该版本。您可以从控制台中的发行管理->应用程序签名->应用程序签名证书下访问用于签署发行版本的密钥。



找到证书后,您需要使用SHA1密钥,并生成一个新的Android Oauth凭据,然后将其添加到您的google-services.json中。如果您不使用Firebase,则还必须将Oauth凭据添加到您的后端。 ,您可以在Play控制台上看到可以在何处获取证书信息的图片。



google signIn无法在发布模式下运行apk android


I developed a app with Flutter and tested on my device using the command:

flutter run --release

and everything worked fine. I also tried building the app with:

flutter build apk --release

and installing it manually, and still everything was ok.
I uploaded on the store, and now the login doesn't work anymore. I tried looking at the logcat and the error i get when i try to login is:

I/flutter: exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 12500: , null)

I tried adding the appCompat dependency and I checked the the SHA1 keys, everything is in the right place, I can't figure out why when I download if from the store it doesn't work anymore.

解决方案

Your app probably does not have the correct Google credentials for the Token API.

When you first signed up on the Google Play Console, you probably opted into Google's app signing service. What this does is, after you sign your app with your keystore and upload it to the Play Console, Google will actually sign your app with a generated keystore and roll that version out. You can access the keys with which the release version is signed from the console, under Release Management -> App signing -> App signing certificate.

Once you locate the certificate, you need to use the SHA1 key, and generate a new Android Oauth Credential, and then add that to your google-services.json. If you are not using Firebase, you will have to add the Oauth credential to your backend as well.

If you look at HarshitG's answer on this Android thread concerning the same issue, you can see a picture of where you can get the certificate information on the Play Console.

google signIn not working in release mode apk android

这篇关于发布Flutter应用后,Google登录无法正常运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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