Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 257
Andrea Grippi Avatar asked Nov 12 '18 13:11

Andrea Grippi


People also ask

How do I add Google login to flutter?

Step 1: First create the flutter project in your IDE. Step 2: After that just remove the default code and start from scratch. Step 3: Now just import the material library and call the runApp( ) function into the main function name as GoogleSignIn. Step 4: Now make a stateful widget with the name 'GoogleSignIn'.

How do you run apps in release mode flutter?

To compile in release mode, we just need to add the --release flag to the flutter run command and have a physical device connected. Although we can do so, we typically do not use the flutter run command with the --release flag.


2 Answers

You likely have to register your Play Store app signing key with API providers (in this case Firebase).

  1. In your Google Play Console, visit Setup > App signing

  2. Copy SHA-1 certificate fingerprint

    Copy SHA-1 from Google Play App signing key certificate

  3. In your Firebase Console, visit Settings > Project settings

  4. Click Add fingerprint

    Add fingerprint in Firebase console

  5. Paste copied SHA-1 certificate fingerprint into Certificate fingerprint textfield

  6. Click Save

    Paste SHA-1 certificate & save

like image 80
Jon Saw Avatar answered Sep 29 '22 12:09

Jon Saw


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

like image 25
Alec Avatar answered Sep 29 '22 14:09

Alec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!