Issue
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
andpod install
- Cleaning DerivedData (both through XCode and manually)
- Remove and re-add firebase-ios-sdk
But to no avail.
Solution
I've managed to resolve this issue by removing the firebase-ios-sdk dependency altogether. It appears that this is imported by the Flutter dependencies and adding it manually thus leads to a redefinition error.
I'd advise any people encountering this or similar errors to make sure that the integration steps they are following are meant for Flutter and not for iOS (only).
Answered By - Wouter Pol
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.