0

When i try sign in with google account i get that error in my terminal:

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

My pubspec.yaml file:

google_sign_in: ^4.5.6

My codes:

import 'package:google_sign_in/google_sign_in.dart';

class androidLogInPage extends StatefulWidget {
  @override
  _androidLogInPageState createState() => _androidLogInPageState();
}

class _androidLogInPageState extends State<androidLogInPage> {
  bool _isLoggedIn = false;

  GoogleSignIn _googleSignIn = GoogleSignIn();
  Future _logIn() async {
    try {
      await _googleSignIn.signIn();
      setState(() {
        _isLoggedIn = true;
      });
    } catch (err) {
      print(err);
    }
  }

  _logOut() {
    _googleSignIn.signOut();
    setState(() {
      _isLoggedIn = false;
    });
  }

I already have SHA-1 key, what should i do? I need help.

  • 1
    Does this answer your question? [Why do I get com.google.android.gms.common.api.ApiException: 10:?](https://stackoverflow.com/questions/47437678/why-do-i-get-com-google-android-gms-common-api-apiexception-10) – Dmytro Rostopira Jan 05 '21 at 09:02
  • Thanks Dima! I found the solution. I created new SHA-1 and SHA-256 key and that's solved my problem. – Ergün Yunus Cengiz Jan 05 '21 at 11:14

1 Answers1

0

Normally the platform exception comes when you add a dependecy that uses native Android or iOS code. I think you should close the App and reerun the application and it should work. This appers because it only reloads the Flutter code and not the native.

Ayad
  • 671
  • 5
  • 16