Skip to content

[google_sign_in] java.lang.NullPointerException: Attempt to read from field [...] on a null object reference #74308

Closed
flutter/packages
#9267

Description

@jakub-trzebiatowski

I found a following stack trace in my team's Crashlytics:

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'io.flutter.plugin.common.MethodChannel$Result io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate$PendingOperation.result' on a null object reference
       at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.finishWithSuccess(GoogleSignInPlugin.java:2)
       at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.onSignInAccount(GoogleSignInPlugin.java:69)
       at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.onSignInResult(GoogleSignInPlugin.java:8)
       at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.access$000(GoogleSignInPlugin.java)
       at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate$1.onComplete(GoogleSignInPlugin.java:2)
       at com.google.android.gms.tasks.zzj.run(zzj.java:23)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at com.google.android.gms.internal.tasks.zzb.dispatchMessage(zzb.java)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

One occurrence, app with ~1000 active users.

I had a quick look at the plugin's code in the location mentioned in the stack trace. result is passed through a few layers without a null-check. Maybe there's a reasonable (but rare) path when it actually can be null?

Activity

  1. TahaTesser commented on Jan 20, 2021

    @TahaTesser
    Contributor

    Hi @cubuspl42
    Can you please provide your flutter doctor -v and pubpsec.yaml
    Thank you

  2. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 20, 2021
  3. jakub-trzebiatowski commented on Jan 20, 2021

    @jakub-trzebiatowski
    Author
    ▶ flutter doctor -v
      ╔════════════════════════════════════════════════════════════════════════════╗
      ║ A new version of Flutter is available!                                     ║
      ║                                                                            ║
      ║ To update to the latest version, run "flutter upgrade".                    ║
      ╚════════════════════════════════════════════════════════════════════════════╝
    
    
    [✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.14.6 18G6032, locale en-PL)
        • Flutter version 1.22.3 at /Users/jakub/Frameworks/flutter
        • Framework revision 8874f21e79 (3 months ago), 2020-10-29 14:14:35 -0700
        • Engine revision a1440ca392
        • Dart version 2.10.3
    
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
        • Android SDK at /Users/jakub/Library/Android/sdk
        • Platform android-29, build-tools 29.0.3
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.2.1, Build version 11B500
        • CocoaPods version 1.10.0
    
    [!] Android Studio (version 4.0)
        • Android Studio at /Applications/Android Studio.app/Contents
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    
    [!] IntelliJ IDEA Ultimate Edition (version 2020.3)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
        • For information about installing plugins, see
          https://flutter.dev/intellij-setup/#installing-the-plugins
    
    [✓] IntelliJ IDEA Community Edition (version 2020.3.1)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin installed
        • Dart plugin version 203.6912
    
    [!] VS Code (version 1.47.3)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        ✗ Flutter extension not installed; install from
          https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    
    [!] Connected device
        ! No devices available
    
    ! Doctor found issues in 4 categories.
    
    version: 0.1.0+0
    
    environment:
      sdk: ">=2.6.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
    
      flutter_localizations:
        sdk: flutter
    
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^1.0.0
    
      pedantic: ^1.8.0
      flutter_facebook_login: ^3.0.0
      sign_in_with_apple: ^2.1.0+1
      firebase_auth: ^0.20.0
      flutter_svg: ^0.19.0
      carousel_slider: ^2.0.0
      http: ^0.12.0+1
      google_sign_in: ^4.0.1+1
      googleapis: ^0.56.0
      test: ^1.5.3
      shared_preferences: ^0.5.2
      quantity: ^1.0.0
      url_launcher: ^5.0.2
      dartz: ^0.9.1
      csv: ^4.0.3
      package_info: ^0.4.0+4
      device_info: ^1.0.0
      firebase_crashlytics: ^0.4.0
      firebase_core: ^0.7.0
      uuid: ^2.0.2
      meta: ^1.1.6
      firebase_dynamic_links: ^0.7.0
      rxdart: ^0.25.0
      cloud_firestore: ^0.16.0
      cloud_functions: ^0.9.0
      firebase_analytics: ^7.0.0
      firebase_performance: ^0.5.0
      firebase_remote_config: ^0.6.0
      intl: ^0.16.1
      intl_translation: ^0.17.7
      flutter_hooks: ^0.15.0
      more: ^2.2.0
      share: ^0.6.5
      expandable: ^4.0.1
      flutter_keyboard_visibility: ^4.0.0
      flutter_markdown: ^0.5.0
      collection: ^1.14.11
      animated_widgets: ^1.0.3
      charts_flutter: ^0.9.0
      crypto: ^2.1.3
      pub_semver: ^1.4.2
      device_preview: ^0.5.4
      visibility_detector: ^0.1.4
      cached_network_image: ^2.0.0
      flutter_blurhash: ^0.5.0
      in_app_purchase: ^0.3.3
      step_progress_indicator: ^0.2.1
      synchronized: ^2.2.0
      lottie: ^0.7.0
      animations: ^1.1.1
      freezed_annotation: ^0.12.0
      memoize: ^2.0.0
      app_review: ^2.0.0
      stack_trace: ^1.9.5
      video_player: ^1.0.0
      chewie: ^0.12.0
      path_provider: ^1.6.14
      firebase_storage: ^7.0.0
      wakelock: ^0.2.1
      simple_gesture_detector: ^0.1.4
      fit_kit: ^1.1.2
      permission_handler: ^5.0.1+1
      retry: ^3.0.1
      google_api_availability: ^2.0.4
      modal_progress_hud: ^0.1.3
      worker_manager: ^3.2.5
      android_play_install_referrer: ^0.0.4
    
    dependency_overrides:
      platform: 3.0.0-nullsafety.2
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
      flutter_driver:
        sdk: flutter
    
      flutter_launcher_icons: ^0.8.0
      mockito: ^4.0.0
    
      build_runner: ^1.10.1
      freezed: ^0.12.0
      json_serializable: ^3.2.0
      flutter_gen: ^1.2.1
    
    flutter_icons:
      android: true
      ios: true
      image_path_android: "icons/android.png"
      image_path_ios: "icons/ios.png"
    
    flutter_gen:
      integrations:
        flutter_svg: true
    
    # For information on the generic Dart part of this file, see the
    # following page: https://www.dartlang.org/tools/pub/pubspec
    
    # The following section is specific to Flutter.
    flutter:
      fonts:
        - family: WorkSans
          fonts:
            - asset: fonts/WorkSans-Regular.ttf
            - asset: fonts/WorkSans-Light.ttf
              weight: 300
            - asset: fonts/WorkSans-Medium.ttf
              weight: 500
            - asset: fonts/WorkSans-Bold.ttf
              weight: 700
        - family: Roboto
          fonts:
            - asset: fonts/Roboto-Regular.ttf
    
      # 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
    
    
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 20, 2021
  5. SaavyGirl commented on Jan 20, 2021

    @SaavyGirl
  6. TahaTesser commented on Jan 21, 2021

    @TahaTesser
    Contributor

    Hi @cubuspl42
    You seem to be using an old version of google_sign_in and an older Flutter stable channel.
    Please upgrade your google_sign_in and flutter channel to the latest stable releases.
    flutter channel stable
    flutter upgrade --force
    flutter doctor -v

    If the problem persists, provide the UPDATED futter doctor -v and pubspec.yaml.
    Thank you

  7. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 21, 2021
  8. jakub-trzebiatowski commented on Jan 25, 2021

    @jakub-trzebiatowski
    Author

    Latest non-prerelease version of google_sign_in: 4.5.9

    My version from pubspec.lock:

      google_sign_in:
        dependency: "direct main"
        description:
          name: google_sign_in
          url: "https://pub.dartlang.org"
        source: hosted
        version: "4.5.9"
    

    ...so it's the newest.

    Please note that the stack trace comes from production, from Crashlytics. It's a fatal crash. The production build is built on CI/CD, with a relatively new Flutter framework version. So my local flutter doctor output doesn't matter. But anyway, I really don't think that a non-ancient Flutter framework can be responsible for a NullPointerException inside io.flutter.plugins.googlesignin.GoogleSignInPlugin!

  9. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 25, 2021
  10. jakub-trzebiatowski commented on Jan 25, 2021

    @jakub-trzebiatowski
    Author

    I just confirmed that my team uses Flutter 1.22.5 on CI/CD.

  11. added
    a: productionIssues experienced in live production apps
    and removed
    in triagePresently being triaged by the triage team
    on Jan 26, 2021
  12. 9 remaining items

  13. github-actions commented on Jul 8, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  14. locked as resolved and limited conversation to collaborators on Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Important issues not at the top of the work lista: productionIssues experienced in live production appsc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processp: google_sign_inThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions