Debug School

rakesh kumar
rakesh kumar

Posted on • Updated on

Flutter Error:-PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)

Reference
platformexceptionsign-in-failed-com-google

platformexceptionsign-in-failed-com-google
platformexceptionsign-in-failed-com-google
platformexceptionsign-in-failed-com-google-android-gms-common-api-apiexception
platformexceptionsig
platformexceptionsign_in_failed-com-google-android-gms-common-api
Error:

final GoogleSignIn _googleSignIn = GoogleSignIn(
  scopes: [
    'https://www.googleapis.com/auth/drive',
  ],
);

await _googleSignIn.signIn();
Enter fullscreen mode Exit fullscreen mode

That's the stack trace:

E/flutter ( 5068): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter ( 5068): PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
E/flutter ( 5068): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7)
E/flutter ( 5068): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:292:18)
E/flutter ( 5068): <asynchronous suspension>
E/flutter ( 5068): #2      GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:226:58)
E/flutter ( 5068): <asynchronous suspension>
E/flutter ( 5068): #3      GoogleSignIn._addMethodCall (package:google_sign_in/google_sign_in.dart:268:20)
E/flutter ( 5068): #4      GoogleSignIn.signIn (package:google_sign_in/google_sign_in.dart:339:48)
E/flutter ( 5068): #5      ThatsMyComponentState.theSignInFuction.<anonymous closure> (package:my_app/widgets/my_file.dart:666:45)
E/flutter ( 5068): <asynchronous suspension>
E/flutter ( 5068): #6      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14)
E/flutter ( 5068): #7      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30)
E/flutter ( 5068): #8      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter ( 5068): #9      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter ( 5068): #10     TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:204:7)
E/flutter ( 5068): #11     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter ( 5068): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:184:20)
E/flutter ( 5068): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
E/flutter ( 5068): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
E/flutter ( 5068): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 5068): #16     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
E/flutter ( 5068): #17     _invoke1 (dart:ui/hooks.dart:168:13)
E/flutter ( 5068): #18     _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)
Enter fullscreen mode Exit fullscreen mode

Solution

Check the following things

Case 1:Run ./gradlew signingReport,
it's under the app Android folder. Add SHA1 in google Firebase Google Sign in configuration. developers.google.com/android/guides/client-auth . You will need an SHA1 for each computer you work on.
Case 2
This might happens if you are running on debug and you did not register a SHA fingerprint in firebase. I solved it by generating a debug.keystore and registering it inside the app on Firebase. Don't forget to download the new google-services.json after that. See also this.

Image description

Case 3
-Add the SHA certificate fingerprints of the release key.

keytool -exportcert -list -v \
-alias -keystore

For more details on that see here on the section "get release certificate" https://developers.google.com/android/guides/client-auth

If your authentication is still not working, probably it is because you downloaded the app from Playstore and you enabled the "App Signing by Google Play Feature" Then for this case, go to play store publish console and go to app signing under release management. There you will find the SHA certificate fingerprint to register in Firebase console.
Image description

Top comments (0)