Google sign in doesn't work after release of flutter app

本小妞迷上赌 提交于 2019-12-21 06:03:43

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/53263246/google-sign-in-doesnt-work-after-release-of-flutter-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!