1

Here is where the exception is happening:

 @override
  Future<FirebaseUser> getCurrentUser() async {
    FirebaseUser user = await _firebaseAuth.currentUser();
    return user;
  }

The exact error is:

 Exception has occurred.
PlatformException (PlatformException(error, FirebaseApp with name [DEFAULT] doesn't exist. , null))

My Flutter Doctor Output:

[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
    • Flutter version 1.12.13+hotfix.5 at D:\src\flutter
    • Framework revision 27321ebbad (7 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\jcdos\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: D:\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[!] Android Studio (version 3.5)
    • Android Studio at D:\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
exit code 0

Here is my debug console:

E/flutter ( 6562): #40     SingleChildRenderObjectElement.mount 
package:flutter/…/widgets/framework.dart:5445
E/flutter ( 6562): #41     Element.inflateWidget 
package:flutter/…/widgets/framework.dart:3194
E/flutter ( 6562): #42     Element.updateChild 
package:flutter/…/widgets/framework.dart:2988
E/flutter ( 6562): #43     ComponentElement.performRebuild 
package:flutter/…/widgets/framework.dart:4243
E/flutter ( 6562): #44     Element.rebuild 
package:flutter/…/widgets/framework.dart:3947
E/flutter ( 6562): #
√ Built build\app\outputs\apk\debug\app-debug.apk.

I've tried finding other sources to fix the error, but nothing works. I removed apply plugin: 'com.google.gms.google-services' from the app gradle as that was causing me other issues. And removing this fixed it, as the source I found said it gets called already somewhere else.

And if I keep the com.google.gms.google-services then I get this error which prevents the app from running in the emulator all together:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'com.example.testapp
halfer
  • 19,824
  • 17
  • 99
  • 186
Justin Dosaj
  • 447
  • 1
  • 6
  • 12
  • You shouldn't remove the google-services plugin. That's the thing that arranges to initialize Firebase at app startup, and is causing that error you see now. If you think it was causing other problems, you should be addressing those instead. – Doug Stevenson Dec 18 '19 at 00:03
  • @DougStevenson I updated the question at the bottom with the error occurs if I do use the google-services plug-in – Justin Dosaj Dec 18 '19 at 00:24

2 Answers2

2

Add below line into your android/app/build.gradle file:

apply plugin: 'com.google.gms.google-services'

enter image description here

duongdt3
  • 1,648
  • 11
  • 16
0

Run the application in Android studio it should show some of the errors or files that need to be updated like in the build.gradle files. Also, you need the com.google.gms.google-services for firebase.

Rlee128
  • 97
  • 2
  • 12