I know there's a lot of information around the web and I've read all the posts and articles I found on the web and still can't figure it out and google documentation about the errors is very bad. Many people complains about it but I don't see any obvious fix and most people are using debug and development mode to avoid this setup.
I've created a flutter app that needs to make Google Sign In and of course, it don't work.
1) I've created the firebase project, activated the android app project, placed the SHA1 release and the .json on the project.
2) I've followed the flutter docs to release the app (key.properties, changing the signingConfigs and that stuff. App it's not on the Play Store, I'm testing on my phone.
2.1) keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
3) Flutter dependencies:
firebase_auth: 0.7.0
google_sign_in: 3.2.4
cloud_firestore: 0.8.2+3
fluttertoast: ^2.0.7
image_picker: 0.4.12+1
shared_preferences: 0.4.3
firebase_storage: 1.0.4
cached_network_image: ^0.7.0
intl: ^0.15.7
firebase_core: ^0.2.5
4) I'm using the new GoogleAuthProvider.getCredential and not the old SignInWithGoogle
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
4.1) Built build\app\outputs\apk\debug\app-debug.apk.
5) When I press login I get this errors:
E/flutter (23045): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
E/flutter (23045): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
E/flutter (23045): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:302:33)
E/flutter (23045): <asynchronous suspension>
E/flutter (23045): #2 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:217:58)
E/flutter (23045): <asynchronous suspension>
E/flutter (23045): #3 GoogleSignIn._addMethodCall (package:google_sign_in/google_sign_in.dart:256:20)
E/flutter (23045): #4 GoogleSignIn.signIn (package:google_sign_in/google_sign_in.dart:324:48)
E/flutter (23045): #5 _LoginScreenState._handleSignIn (package:flikmechat/login_signup.dart:69:57)
E/flutter (23045): <asynchronous suspension>
E/flutter (23045): #6 _LoginScreenState._loginPage.<anonymous closure> (package:flikmechat/login_signup.dart:566:52)
E/flutter (23045): <asynchronous suspension>
E/flutter (23045): #7 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:511:14)
E/flutter (23045): #8 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:566:30)
E/flutter (23045): #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:166:24)
E/flutter (23045): #10 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:240:9)
E/flutter (23045): #11 TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:211:7)
E/flutter (23045): #12 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (23045): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:225:20)
E/flutter (23045): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:199:22)
E/flutter (23045): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (23045): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (23045): #17 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (23045): #18 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (23045): #19 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (23045): #20 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (23045): #21 _invoke1 (dart:ui/hooks.dart:233:10)
E/flutter (23045): #22 _dispatchPointerDataPacket (dart:ui/hooks.dart:154:5)
Please advise, I really don't know what to do. Thank you so much.
