title: Flutter Firebase Authentication With Google App Crash
body: <p>I am making a "Sign In With Google" button using Flutter but when I click the button the app crashes and exit although I am sure that Firebase is correctly integrated with the app and the SHA1 is correct as well as the app works well with Firestore</p>
  
  <p><strong>here are the code and the error.</strong></p>
  
  <p><strong>error :</strong> </p>
  
  <pre><code>I/art     (13904): Rejecting re-init on previously-failed class java.lang.Class&lt;com.google.android.gms.auth.api.signin.internal.SignInHubActivity&gt;
  I/art     (13904): Rejecting re-init on previously-failed class java.lang.Class&lt;com.google.android.gms.auth.api.signin.internal.SignInHubActivity&gt;
  E/flutter (13904): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(40)] java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/signin/internal/SignInHubActivity;
  E/flutter (13904):  at com.google.android.gms.auth.api.signin.internal.zzh.zzc(Unknown Source)
  E/flutter (13904):  at com.google.android.gms.auth.api.signin.GoogleSignInClient.getSignInIntent(Unknown Source)
  E/flutter (13904):  at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.signIn(GoogleSignInPlugin.java:291)
  E/flutter (13904):  at io.flutter.plugins.googlesignin.GoogleSignInPlugin.onMethodCall(GoogleSignInPlugin.java:77)
  E/flutter (13904):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
  E/flutter (13904):  at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
  E/flutter (13904):  at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:643)
  E/flutter (13904):  at android.os.MessageQueue.nativePollOnce(Native Method)
  E/flutter (13904):  at android.os.MessageQueue.next(MessageQueue.java:331)
  E/flutter (13904):  at android.os.Looper.loop(Looper.java:218)
  E/flutter (13904):  at android.app.ActivityThread.main(ActivityThread.java:5526)
  E/flutter (13904):  at java.lang.reflect.Method.invoke(Native Method)
  E/flutter (13904):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  E/flutter (13904):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  E/flutter (13904): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.signin.internal.SignInHubActivity" on path: DexPathList[[zip file "/data/app/com.example.tester-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.tester-1/lib/arm, /data/app/com.example.tester-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
  E/flutter (13904):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  E/flutter (13904):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  E/flutter (13904):  at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
  E/flutter (13904):  ... 14 more
  E/flutter (13904):  Suppressed: java.lang.NoClassDefFoundError: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
  E/flutter (13904):      at dalvik.system.DexFile.defineClassNative(Native Method)
  E/flutter (13904):      at dalvik.system.DexFile.defineClass(DexFile.java:226)
  E/flutter (13904):      at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
  E/flutter (13904):      at dalvik.system.DexPathList.findClass(DexPathList.java:338)
  E/flutter (13904):      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
  E/flutter (13904):      ... 16 more
  E/flutter (13904):  Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
  E/flutter (13904):      at java.lang.Class.classForName(Native Method)
  E/flutter (13904):      at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
  E/flutter (13904):      at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
  E/flutter (13904):      at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
  E/flutter (13904):      ... 15 more
  E/flutter (13904):  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
  E/flutter (13904):
  F/flutter (13904): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env).
  F/libc    (13904): Fatal signal 6 (SIGABRT), code -6 in tid 13904 (.example.tester)
  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
  UUID: 82d8c901-de47-4729-a4c6-a013707000ca
  Build fingerprint: 'Sony/D6503/D6503:6.0.1/23.5.A.1.291/2769308465:user/release-keys'
  Revision: '0'
  ABI: 'arm'
  pid: 13904, tid: 13904, name: .example.tester  &gt;&gt;&gt; com.example.tester &lt;&lt;&lt;
  signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
  Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env).
  '
      r0 00000000  r1 00003650  r2 00000006  r3 b6fe9b7c
      r4 b6fe9b84  r5 b6fe9b34  r6 0000000b  r7 0000010c
      r8 bee23e9c  r9 00000000  sl 00000001  fp b6f7cc11
      ip 00000006  sp bee23d78  lr b6d4ecb1  pc b6d510a0  cpsr 400f0010
  backtrace:
      #00 pc 000420a0  /system/lib/libc.so (tgkill+12)
      #01 pc 0003fcad  /system/lib/libc.so (pthread_kill+32)
      #02 pc 0001c463  /system/lib/libc.so (raise+10)
      #03 pc 00019615  /system/lib/libc.so (__libc_android_abort+34)
      #04 pc 00017568  /system/lib/libc.so (abort+4)
      #05 pc 00b0cc63  /data/app/com.example.tester-1/lib/arm/libflutter.so (offset 0xafe000)
      #06 pc 00b03411  /data/app/com.example.tester-1/lib/arm/libflutter.so (offset 0xafe000)
      #07 pc 00b02107  /data/app/com.example.tester-1/lib/arm/libflutter.so (offset 0xafe000)
      #08 pc 00b338ef  /data/app/com.example.tester-1/lib/arm/libflutter.so (offset 0xafe000)
      #09 pc 00b0d3c5  /data/app/com.example.tester-1/lib/arm/libflutter.so (offset 0xafe000)
      #10 pc 00b107ab  /data/app/com.example.tester-1/lib/arm/libflutter.so (offset 0xafe000)
      #11 pc 00012e03  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+530)
      #12 pc 00012ed3  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+130)
      #13 pc 00082a59  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
      #14 pc 72d4655d  /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x1f66000)
  Tombstone written to: /data/tombstones/tombstone_08
  </code></pre>
  
  <p><strong>code is all in main.dart :</strong></p>
  
  <pre><code>import 'package:firebase_auth/firebase_auth.dart';
  import 'package:flutter/material.dart';
  import 'package:flutter/services.dart';
  import 'package:google_sign_in/google_sign_in.dart';
  import 'package:provider/provider.dart';
  import 'package:tester/locator.dart';
  import 'package:tester/ui/views/HomeView.dart';
  
  import 'core/viewmodels/crudModel.dart';
  
  main(List&lt;String&gt; args) {
    setupLocator();
    runApp(TestApp());
  }
  
  class TestApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      SystemChrome.setSystemUIOverlayStyle(
        SystemUiOverlayStyle(statusBarColor: Colors.green),
      );
      return MultiProvider(
        providers: [
          ChangeNotifierProvider(
            builder: (_) =&gt; locator&lt;CRUDModel&gt;(),
          )
        ],
        child: MaterialApp(
          debugShowCheckedModeBanner: false,
          theme: ThemeData(
            accentColor: Colors.green,
            primaryColor: Colors.green,
          ),
          home: GoogleLoginView(),
        ),
      );
    }
  }
  
  class GoogleLoginView extends StatelessWidget {
    final GoogleSignIn _googleSignInObject = GoogleSignIn();
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: Text('Google Login'),
        ),
        body: Center(
          child: RaisedButton(
            color: Colors.green,
            splashColor: Colors.greenAccent,
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(20),
            ),
            onPressed: _googleSignIn,
            child: Text('Google Sign In'),
          ),
        ),
      );
    }
  
    Future&lt;void&gt; _googleSignIn() async {
      GoogleSignInAccount _googleSignInAccount =
          await _googleSignInObject.signIn().catchError((e) =&gt; print(e));
      GoogleSignInAuthentication _googleSignInAuthentication =
          await _googleSignInAccount.authentication.catchError((e) =&gt; print(e));
      await FirebaseAuth.instance.signInWithCredential(
        GoogleAuthProvider.getCredential(
          idToken: _googleSignInAuthentication.idToken,
          accessToken: _googleSignInAuthentication.accessToken,
        ),
      ).catchError((e) =&gt; print(e));
    }
  }
  </code></pre>
  
  <p><strong>pubspec.yaml :</strong></p>
  
  <pre><code>name: tester
  description: A new Flutter project.
  
  # The following defines the version and build number for your application.
  # A version number is three numbers separated by dots, like 1.2.43
  # followed by an optional build number separated by a +.
  # Both the version and the builder number may be overridden in flutter
  # build by specifying --build-name and --build-number, respectively.
  # In Android, build-name is used as versionName while build-number used as versionCode.
  # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
  # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
  # Read more about iOS versioning at
  # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
  version: 1.0.0+1
  
  environment:
    sdk: "&gt;=2.1.0 &lt;3.0.0"
  
  dependencies:
    flutter:
      sdk: flutter
  
    # The following adds the Cupertino Icons font to your application.
    # Use with the CupertinoIcons class for iOS style icons.
    cupertino_icons: ^0.1.2
    provider: ^3.0.0+1
    get_it: ^1.0.3+2
    cloud_firestore: ^0.12.9
    firebase_core: ^0.4.0+8
    google_sign_in: ^4.0.6
    firebase_auth: ^0.14.0+1
  
  dev_dependencies:
    flutter_test:
      sdk: flutter
  
  
  # For information on the generic Dart part of this file, see the
  # following page: https://dart.dev/tools/pub/pubspec
  
  # The following section is specific to Flutter.
  flutter:
  
    # The following line ensures that the Material Icons font is
    # included with your application, so that you can use the icons in
    # the material Icons class.
    uses-material-design: true
  
    # To add assets to your application, add an assets section, like this:
    assets:
     - res/images/bag.jpg
     - res/images/computer.jpg
     - res/images/dress.jpg
     - res/images/phone.jpg
     - res/images/shoes.jpg
  
    # An image asset can refer to one or more resolution-specific "variants", see
    # https://flutter.dev/assets-and-images/#resolution-aware.
  
    # For details regarding adding assets from package dependencies, see
    # https://flutter.dev/assets-and-images/#from-packages
  
    # To add custom fonts to your application, add a fonts section here,
    # in this "flutter" section. Each entry in this list should have a
    # "family" key with the font family name, and a "fonts" key with a
    # list giving the asset and other descriptors for the font. For
    # example:
    # fonts:
    #   - family: Schyler
    #     fonts:
    #       - asset: fonts/Schyler-Regular.ttf
    #       - asset: fonts/Schyler-Italic.ttf
    #         style: italic
    #   - family: Trajan Pro
    #     fonts:
    #       - asset: fonts/TrajanPro.ttf
    #       - asset: fonts/TrajanPro_Bold.ttf
    #         weight: 700
    #
    # For details regarding fonts from package dependencies,
    # see https://flutter.dev/custom-fonts/#from-packages
  </code></pre>