Aquarius_Girl
Aquarius_Girl

Reputation: 22926

Have you added the "GoogleService-Info.plist" file to the project? --- Firebase with Flutter and Visual Studio code

I have XCode installed because flutter doctor required it but I am not using it.

I am using VSCode.
In VSCode where am I supposed to put this file called GoogleService-Info.plist?

The project uses Flutter and Firebase.

This is the error:

Exception has occurred. FirebaseException ([core/not-initialized] Firebase has not been correctly initialized. Have you added the "GoogleService-Info.plist" file to the project?

Upvotes: 2

Views: 8298

Answers (3)

Hemal Moradiya
Hemal Moradiya

Reputation: 2077

In VSCode, follow this steps

  1. Right click on ios folder
  2. Choose Open in Xcode
  3. Select Runner > Runner and right click
  4. Choose Add Files to ‘Runner’
  5. Select your GoogleService-Info.plist and press Add

And configure firebase in AppDelegate.swift file like this

import UIKit
import Flutter
import Firebase  /// 1. ADD THIS LINE

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    FirebaseApp.configure() /// 2. ADD THIS LINE
    GeneratedPluginRegistrant.register(with: self)
 
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Upvotes: 12

Victor Eronmosele
Victor Eronmosele

Reputation: 7706

Add the GoogleService-Info.plist file to the project by following these steps from the documentation:

  1. Using Xcode, open the project's ios/{projectName}.xcworkspace file. Right click Runner from the left-hand side project navigation within Xcode and select "Add files".
  2. Select the GoogleService-Info.plist file you downloaded, and ensure the "Copy items if needed" checkbox is enabled.

Upvotes: 4

Leon
Leon

Reputation: 364

Go to your "projectName">android>app and dump the file in this directory.

Upvotes: -4

Related Questions