Flutter: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin'

Issue

I have been trying to run my Flutter code on IOS device. However I am getting some errors regarding non-modular headers inside Framework module.

Logs:

While building module 'firebase_core' imported from
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5:
In file included from <module-includes>:1:
In file included from
/Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Target Support
Files/firebase_core/firebase_core-umbrella.h:13:
In file included from
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_core-0.7.0/ios/Classes/FLTFirebaseCorePlugin.h:11:
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_core-0.7.0/ios/Classes/FLTFirebasePlugin.h:9:9: error:
include of non-modular header inside framework module
'firebase_core.FLTFirebasePlugin':
'/Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Headers/Public/Firebase
Core/FirebaseCore.h'
[-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
        ^
1 error generated.
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5:9: fatal
error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
 ~~~~~~~^
2 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

What I have tried:

  1. I tried to change build settings of Xcode and allow non-modular imports -> flutter clean -> pod install in ios folder -> flutter run

  2. Tried changing the file to public from project, but it already was public.

  3. Reinstall all the pod files.

    ‘firebase_core.FLTFirebasePlugin’:
    Screenshot

Solution

What worked eventually:

  1. Put all the pubspec.yaml dependencies to the latest version.
  2. Delete pubspec.lock, Pods folder in ios and Podfile.lock
  3. Run flutter clean -> flutter pub get -> cd ios -> pod install -> cd .. -> flutter run

And you should be good to go

Answered By – Ali Solanki

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.