skip to Main Content

I recently added the Google Sign-In method to my Flutter project, and I’ve thoroughly checked all SHA-1 and SHA-256 keys. Everything seems to be working fine. However, when I publish my app on the Play Store, it doesn’t work. I also use Google Crashlytics to catch errors, but no errors are appearing in my console.

An important note: Before I started this project, there was another Flutter project on the Play Store, and I updated this project by using the same package names.

UPDATE:(14.09.2023),

Some of the steps I’ve taken to resolve this issue include:

error message

Adding the application signing and upload keys from Google Play Console to the SHA-1 keys in Firebase project settings.
Requesting a new SHA-1 signing and upload key from Google Play Console.
Finally, I added the debug and release mode keys to Firebase, but the problem still persists.

here are the codes:
google sign-in code
final GoogleSignInAccount? googleSignInAccount =
await _googleSignIn.signIn();

  if (googleSignInAccount != null) {
    final GoogleSignInAuthentication googleSignInAuthentication =
        await googleSignInAccount.authentication;

    final AuthCredential credential = GoogleAuthProvider.credential(
      accessToken: googleSignInAuthentication.accessToken,
      idToken: googleSignInAuthentication.idToken,
    );

    return await _auth.signInWithCredential(credential);
  }
} catch (error, stackTrace) {
  print("Google Sign In Error: $error");
  FirebaseCrashlytics.instance.recordError(error, stackTrace);
}

}

-i have checked all keys and Firebase configurations.

2

Answers


  1. Have you checked this step and made sure Google has approved it if necessary?

    Make sure you've filled out all required fields in the console for OAuth consent screen. Otherwise, you may encounter APIException errors.

    I also noticed you write if (googleSignInAccount != null) {...} but there is nothing tracking if the googleSignInAccount is null. I would change it to record an error if it is null via

      if (googleSignInAccount != null) {
        final GoogleSignInAuthentication googleSignInAuthentication =
            await googleSignInAccount.authentication;
    
        final AuthCredential credential = GoogleAuthProvider.credential(
          accessToken: googleSignInAuthentication.accessToken,
          idToken: googleSignInAuthentication.idToken,
        );
    
        return await _auth.signInWithCredential(credential);
      } else {
      FirebaseCrashlytics.instance.recordError(Exception("Oh no G Account is Null"), StackTrace.current);
    }
    } catch (error, stackTrace) {
      print("Google Sign In Error: $error");
      FirebaseCrashlytics.instance.recordError(error, stackTrace);
    }
    
    Login or Signup to reply.
  2. Play Store signs the app again. I believe this happens when you opt in to use the "upload key".

    You can find the SHA1 fingerprint that Play Store uses under Release->Setup->App signing. If you add that SHA1 to Firebase your release app’s Google Sign In should start to work without an app update.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search