My Flutter/Firebase app is showing no app has been configured yet

12,831

Solution 1

I solved the issue. If you are using swift in your AppDelegate.swift, make sure you've added the following in that order:

FirebaseApp.configure() //add this before the code below
GeneratedPluginRegistrant.register(with: self)

If you're using flutter with objective-c, add the following to your appdelgate.m file:-

didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure]; //add this right after the above

Solution 2

with adding FirebaseApp.configure(), do not forget to import Firebase.

AppDelegate.swift file should start like this:

import UIKit
import Firebase

Solution 3

Here is another method to initialize Firebase which is done by editing your main.dart.

This is probably the preferred solution, because it doesn't initialize Firebase until all of your application widgets are initialized. I had a situation where some Widgets weren't working because their reference to the Firebase instance was null.

WidgetsFlutterBinding.ensureInitialized(); is necessary to do class initialization.

Although the solution given by Sai works, I suspect it doesn't always work due to a subtle initialization issue.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

Solution 4

I also had 'No app has been configured yet' message, this is just a warning, after call await FirebaseMessaging.instance.requestPermission and accept permission(IOS need permission from user), I will get notification from FCM. Of course, on my main function, I need to add these(for new Dart initialization).

WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

No need add 'GoogleService-Info' and FirebaseApp.configure() in AppDelegate anymore, because FlutterFire now supports initialization directly from Dart! New Dart initialization document here: https://firebase.flutter.dev/docs/overview/

Share:
12,831

Related videos on Youtube

Sai Prashanth
Author by

Sai Prashanth

Hey, I do Coding

Updated on June 04, 2022

Comments

  • Sai Prashanth
    Sai Prashanth almost 2 years

    I am making an app in Flutter/Firebase and I am experiencing the following error on my visual studio code terminal:-

    Xcode build done.                                           522.2s
    6.26.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
    6.26.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications 
    proxy enabled, will swizzle remote notification receiver handlers. If you'd 
    prefer to manually integrate Firebase Messaging, add 
    "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow 
    the instructions at:
    https://firebase.google.com/docs/cloud- 
    messaging/ios/client#method_swizzling_in_firebase_messaging
    to ensure proper integration.
    Waiting for iPhone 11 to report its views...                         9ms
    Syncing files to device iPhone 11...                               610ms
    

    any ideas on how to solve this issue......????

    • Besufkad Menji
      Besufkad Menji over 3 years
      did you add GoogleService-Info.plist in your project?
  • Curt Eckhart
    Curt Eckhart over 3 years
    OK. Here's a super funny (aka odd) thing. I have two projects that connect to the same FireBase. One wouldn't build, I used this solution AND IT WORKED. The other one doesn't have the FirebaseApp.configure(), but it works too. I'm sure there is an alternate way to do this, and I'll report back when I figure it out.
  • Curt Eckhart
    Curt Eckhart over 3 years
    I can confirm that making this change to your main.dart will properly initialize your app for connection to Firebase.
  • Pratik Butani
    Pratik Butani over 3 years
    You need to tell where it needs to put otherwise only iOS Devs will understand.
  • Rodolfo Gonçalves
    Rodolfo Gonçalves about 3 years
    Same thing started to happen here after update flutter to 2.0.1. This worked for me as well. But still doesn't understand why I had to update the AppDelegate.swift file. Feels the same @CurtEckhart, have you found why?
  • Rodolfo Gonçalves
    Rodolfo Gonçalves about 3 years
    Did not work for me on flutter 2.1.0. Had to edit the AppDelegate.swift as mentioned on the accepted answer.
  • BillyParadise
    BillyParadise about 3 years
    he's talking about iOS/Runner/AppDelegate.swift
  • Luis
    Luis about 3 years
    (for swift)As mentioned below you have to import firebase at the top import Firebase
  • MBH
    MBH almost 3 years
    Mine also solved when I added for both AppDelegate.swift and main() flutter
  • Zihan
    Zihan over 2 years
    Thanks, @elder, That saved me.
  • Bret Hagen
    Bret Hagen over 2 years
    Can you explain this further? The answer is not very concise. I'm using the new Dart initialization, although I'm receiving the missing GoogleServices log as well.
  • Hien.Nguyen
    Hien.Nguyen over 2 years
    @BretHagen, I edited my answer a little bit. I mean if you following new Dart initialization from document, you can get notification even though you get this message 'No app has been configured yet', may be this message at this time just a warning. FlutterFire document here: firebase.flutter.dev/docs/overview
  • apieceofcode1801
    apieceofcode1801 over 2 years
    you are right, the warning just showing for no affection. With the FlutterFire latest version, we don't need to manually configure anymore.