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

11,531

Solution 1

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

Solution 2

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

Solution 3

go to your google play console , in the release management you'll find app signing, under that there are two Sha keys ,coppy them without the sha part to the firebas projects SHA certificate fingerprints apk will work after that.

Solution 4

For those guys having such problem , They better have a look at the SHA certificate fingerprint assigned to their firebase account . Both release and debug SHA certificate fingerprint is required . To do this you can :

  1. navigate to the android folder in you project
  2. run this command ./gradlew signingReport
  3. find release SHA certificate fingerprint
  4. find debug SHA certificate fingerprint
  5. add them to the firebase account SHA certificate fingerprints
  6. redownload the google-services.json
  7. Add it to your app level folder Your done !
Share:
11,531
Andrea Grippi
Author by

Andrea Grippi

Italian engineer with startup success dream.

Updated on June 07, 2022

Comments

  • Andrea Grippi
    Andrea Grippi almost 2 years

    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.