Search code examples
iosfluttermodulefirebase-analyticsfatal-error

flutter: fatal error: module 'firebase_analytics' not found


After adding firebase dependency on iOS, when I want to run then I get this error

Xcode's output:
↳
    ../ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module
    'firebase_analytics' not found
    @import firebase_analytics;
     ~~~~~~~^~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the precompiled application for the device.

Error launching application on Abir's iPhone.

I already tried many way. like delete pod file, pod update, pod install etc.


Solution

  • I had this same error and here is how to solve it.

    1. Delete the DerivedData from Xcode folder. Open Runner.xcworkspace inside the ios folder of your flutter project then click File -> Workspace Settings -> Click the grey arrow beside DerivedData path and delete the DerivedData inside the Xcode folder. enter image description here

    enter image description here

    1. Delete both Podfile and Podfile.lock files inside ios folder of your flutter project.
    2. Change the Deployment Target to 12.0. You will find the Deployment Target under General -> Deployment Info.

    enter image description here

    1. Clean your ios build folder.

    enter image description here

    1. Run your app (it will generate a new podfile, do not edit this podfile) It should work.