Home > OS >  Flutter on iOS: redefinition of module 'Firebase'
Flutter on iOS: redefinition of module 'Firebase'

Time:01-20

I've been trying to build my flutter app on iOS but flutter run is throwing the following error:

/Users/<MyUser>/Desktop/projects/app/ios/Pods/Firebase/CoreOnly/Source
s/module.modulemap:1:8: error: redefinition of module 'Firebase'
module Firebase {
       ^
/Users/<MyUser>/Library/Developer/Xcode/DerivedData/Runner-dbkgurnsasbvieahfnk
dontejqss/SourcePackages/checkouts/firebase-ios-sdk/CoreOnly/Sources/module.
modulemap:1:8: note: previously defined here
module Firebase {

I've imported the firebase-ios-sdk as per the instructions here. The imported modules are FirebaseCore, FirebaseAuth and FirebaseMessaging. I have not made any modifications to iOS-specific code (anything under /ios) apart from importing Firebase in the AppDelegate.swift file. The updated file now contains the following code:

import UIKit
import Flutter
import Firebase

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

After searching the error I've tried the following steps:

  • flutter clean
  • pod deintegrate and pod install
  • Cleaning DerivedData (both through XCode and manually)
  • Remove and re-add firebase-ios-sdk

But to no avail.

CodePudding user response:

I have been working on this problem myself for days. Unfortunately, I did not find out the solution.

I decided to implement FirebaseMessaging again from scratch and used this great guide. Now it works.

FirebaseMessaging-Guide

CodePudding user response:

If you use M1 try this

arch -x86_64 pod install

  •  Tags:  
  • Related