firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.64k stars 3.96k forks source link

Cancelling Google Sign In on Android & iOS throws exception instead of returning null #501

Closed kroikie closed 4 years ago

kroikie commented 4 years ago

Steps to Reproduce

  1. download the example app : https://github.com/flutter/plugins/blob/0909e96c366f2f06643dd8f3be779a84aec37750/packages/google_sign_in/example/lib/main.dart#L100

  2. add google_sign_in 3.2.4 to pubspeck

  3. Build the App on either Android or iOS emulator

  4. tap the google sign in button.

  5. On Android -> click the back button -> the app throws an exception that is not caught (even by manually adding it to code) On iOS -> click the cancel button on the alert dialog -> the app throws an exception that is not caught (even by manually adding it to code)

5.1 On iOS, the app crashes when the email/phone text input is taped or on the screen prompting to enter email or phone when the cancel button is taped. -> Fixed by upgrading to the latest version of the sdk on master channel.

LOGS

For Cancel button: PlatformException(sign_in_canceled, com.google.GIDSignIn, The user canceled the sign-in flow.) For the iOS crash: ~~The IDE doesn't output anything in the console. I ran it with XCode and got the following error: EXC_BAD_ACCESS (code=1, address=0x48) aka operation that should occur on the main Thread being run on a background thread.~~ -> Fixed by upgrading to the latest version of the sdk on master channel.

Flutter analyze

Analyzing my_team...                                             

   info • The class 'Stream' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions • lib/blocs/messages.bloc.dart:11:3 •
          sdk_version_async_exported_from_core
   info • The method '_onWidgetDidBuild' isn't used • lib/views/login/login.form.dart:84:8 • unused_element
  error • The function 'MyApp' isn't defined • test/widget_test.dart:14:29 • undefined_function

3 issues found. (ran in 5.3s)

Flutter doctor

[✓] Flutter (Channel master, v1.1.10-pre.83, on Mac OS X 10.14.2 18C54, locale fr-FR)
    • Flutter version 1.1.10-pre.83 at /Users/work/Projects/flutter
    • Framework revision b4e9d0a440 (22 hours ago), 2019-01-16 08:47:37 -0800
    • Engine revision 3c0aa918de
    • Dart version 2.1.1 (build 2.1.1-dev.1.0 492df72739)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/work/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/work/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    ✗ Android license status unknown.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.0.beta.2

[!] Android Studio (version 3.1)
    • 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_152-release-1024-b01)

[✓] IntelliJ IDEA Community Edition (version 2018.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 31.3.4
    • Dart plugin version 183.4886.3

[!] VS Code (version 1.30.2)
    • 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 (1 available)
    • iPhone XR • A7D80D85-30D8-4DAA-AB3D-F7FB0B07D57D • ios • iOS 12.1 (simulator)

! Doctor found issues in 3 categories.
maheshj01 commented 4 years ago

@kroikie I still see an exception being thrown for cancelling google sign in,so I believe this is not yet solved

maheshj01 commented 4 years ago

I can confirm that this issue only persists in debug mode,And when signin cancelled in the release mode the app doesnt crash/freeze and continues to function,So I feel this is mostly with the ide that is throws the exception and dart is not able to capture it. so till it gets fixed,release mode gets the job done.

hyochan commented 4 years ago

Still experiencing this.

flutter doctor:

[✓] Flutter (Channel beta, v1.15.17, on Mac OS X 10.15.3 19D76, locale en-KR)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio
[✓] Android Studio (version 3.6)
[!] VS Code (version 1.44.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)