close
Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

Hello Guys How Are You all ?? hope you all are fine. Today I Have faced Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) this error Using google_sign_in plugin in my Flutter project.

When I am Using google_sign_in: ^4.5.6 Plugin for google sign in in my project. I Just want to use Google Drive API so that I was Created a Firebase project, enabled the Google Drive API (that’s what I need for now) from the Google APIs Console.

How Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) Error Occurs?

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)

How to solve Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)?

  1. Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

    to solve Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) Generate SHA1 and SHA256 keys. Add both the SHA1 and SHA256 to firebase. (in you app settings) Download google-services.json to android/app in your project folder. In your terminal run the command flutter clean . Run your flutter app.

  2. How to solve Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)?

    to solve Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) Generate SHA1 and SHA256 keys. Add both the SHA1 and SHA256 to firebase. (in you app settings) Download google-services.json to android/app in your project folder. In your terminal run the command flutter clean . Run your flutter app.

Solution 1 : Generating a debug.keystore and registering it inside the app on Firebase

This Error Must be Because of you did not register a SHA fingerprint in firebase. Without  register a SHA fingerprint in firebase you cant use Google’s API.

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.

To Generate certificate fingerprint Follow below command in your windows terminal.

keytool -exportcert -list -v \ -alias <your-key-name> -keystore <path-to-production-keystore>

Output will be like below

The signing report will include the signing information for each of your app’s variants:

> Task :app:signingReport
Variant: debug
Config: debug
Store: ~/.android/debug.keystore
Alias: AndroidDebugKey
MD5: A5:88:41:04:8D:06:71:6D:FE:33:76:87:AC:AD:19:23
SHA1: A7:89:E5:05:C8:17:A1:22:EA:90:6E:A6:EA:A3:D4:8B:3A:30:AB:18
SHA-256: 05:A2:2C:35:EE:F2:51:23:72:4D:72:67:A5:6C:8C:58:22:2A:00:D6:DB:F6:45:D5:C1:82:D2:80:A4:69:A8:FE
Valid until: Wednesday, August 10, 2044

Just add SHA in your firebase project and then dont forgot to download new google-services.json after that.

Also Read This Google’s Official Method to Authenticating Your Client.

Solution 2 :  Following solution works in flutter project:

  1. Generate SHA1 and SHA256 keys.
  2. Add both the SHA1 and SHA256 to firebase. (in you app settings)
  3. Download google-services.json to android/app in your project folder.
  4. In your terminal run the command flutter clean .
  5. Run your flutter app.

Solution 3

Make sure to be logged in with the same account of Firebase

For Android

  1. Select your firebase project
  2. Select Android
  3. Open terminal inside your flutter project
  4. cd android
  5. ./gradlew signingReport or gradlew signingReport
  6. Paste your package name and your SHA1 key
  7. Download Client Information
  8. Download and replace the google-services.json
  9. flutter clean

For IOS:

  1. Select your Firebase project
  2. Select IOS
  3. Enter your Bundle ID
  4. Download credetials
  5. Download and replace GoogleService-info.plist

So Hope This Above 3 Solution Will Work For You Too. So it’s all About Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) error. Hope this tutorial helped you a lot. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.

Also Read

Comments

3 responses to “Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)”

  1. Kathiravan Avatar
    Kathiravan

    The same code what I used is running in another system .I can login without any errors , can you please help me

  2. esteban Avatar
    esteban

    solution 3 worked like a charm! thank you!

  3. Smit Avatar
    Smit

    solution 3 worked For me! thank you!
    You Saved my Day Thank you again

Leave a Reply

Your email address will not be published. Required fields are marked *