I'm running Flutter 1.22.4 on the stable channel on Mac OS X 10.15.7. I'm using Flutter Authentiction: firebase_core: 0.5.2+1 and firebase_auth: 0.18.3+1.
My Flutter application has a sign-in screen for an email address and password. Here's the code that uses Firebase Auth:
final _provider = FirebaseAuth.instance;
...
SUtil.instance.logger.i('SAuthenticationAdapter.signIn: about to sign out, just in case');
await this.signOut();
SUtil.instance.logger.i('SAuthenticationAdapter.signIn: about to sign in');
await _provider.signInWithEmailAndPassword(email: userName, password: password).then((authResult) {
SUtil.instance.logger.i('SAuthenticationAdapter.signIn: signed in: $authResult');
This code works on iOS and Android devices and in the iOS simulator. But it does not work in the Android emulator. It used to work and took half a minute or one minute to sign in. But now it stopped working altogether. I went back to previous versions of firebase_core and firebase_auth, but no luck.
Here's the output when I can sign in successfully on a real Android phone. It took 20 seconds for the call to complete. It usually runs faster.
I/flutter (18601): [I] TIME: 2020-11-30T12:10:04.320171 SAuthenticationAdapter.signIn: about to sign in
I/BiChannelGoogleApi(18601): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzao@99fb698
W/DynamiteModule(18601): Local module descriptor class for com.google.firebase.auth not found.
I/FirebaseAuth(18601): [FirebaseAuth:] Preparing to create service connection to gms implementation
D/FirebaseAuth(18601): Notifying id token listeners about user ( XXX ).
D/FirebaseAuth(18601): Notifying auth state listeners about user ( XXX ).
I/flutter (18601): [I] TIME: 2020-11-30T12:10:25.841102 AuthenticationAdapter._handleAuthenticationEvent: working: _signedIn=true, _firstCall=false, uid=XXX, user=User(...)
I/flutter (18601): [I] TIME: 2020-11-30T12:10:25.841598 SAuthenticationManager._handleAuthenticationEvent: user is signed IN
Here's the output of running exactly the same code in the Android emulator "Pixel 2 API 28 with Google Play Store". I included the output of the sign-out call to Firebase Auth right before that works just fine:
I/flutter ( 7073): [I] TIME: 2020-11-30T13:09:48.418336 SAuthenticationAdapter.signOut: about to sign out
AuthenticationAdapter._handleAuthenticationEvent: User is signed OUT!
I/flutter (16448): [I] TIME: 2020-11-30T12:15:34.480042 SAuthenticationAdapter.signIn: about to sign in
I/BiChannelGoogleApi(16448): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzao@2586f12
F/crash_dump32(18634): crash_dump.cpp:398] failed to get process threads: No such file or directory
It seems to crash after sitting there for a couple of minutes. I've got a spinner that launches on the sign-in screen with the start of the sign-in process. That spinner never goes away in the Android emulator.
I implemented the onError and catchError in my call to _provider.signInWithEmailAndPassword(). I even surrounded that call with a try ... catch block. But none of these places output anything. I temporarily disabled firebase_performance, firebase_crashlytics and firebase_analytics, but that didn't help, either.
How can I further debug this to find out why that call is hanging?