Flutter iOS project is not running in Xcode, but it is working in Android Studio and giving a "module not found error"

1.1k Views Asked by At

GeneratedPluginRegistrant.m

As you can see in the GeneratedPluginRegistrant.m file, I am trying to import my plugins and I tried many times to fix it using these command:

main: flutter clean

main: flutter pub get

iOS: pod deintegrate

iOS: pod install

iOS: pod install clear cache --all

In Xcode, Clean pod build folder, but not yet get any solution.

When I fix on the plugin issue (if i am removing then it's showing me another plugin issue, but it is same as the first. If I removed plugins from my pubspec.yaml file then it's also showing this issue. How can I solve this issue?

// Generated file. Do not edit.

// clang-format off

#import "GeneratedPluginRegistrant.h"

#if __has_include(<cloud_firestore/FLTFirebaseFirestorePlugin.h>)
#import <cloud_firestore/FLTFirebaseFirestorePlugin.h>
#else
@import cloud_firestore;  Error is here -> Module 'cloud_firestore' not found
#endif

#if __has_include(<connectivity/FLTConnectivityPlugin.h>)
#import <connectivity/FLTConnectivityPlugin.h>
#else
@import connectivity;
#endif

#if __has_include(<contact_picker/ContactPickerPlugin.h>)
#import <contact_picker/ContactPickerPlugin.h>
#else
@import contact_picker;
#endif

#if __has_include(<device_info/FLTDeviceInfoPlugin.h>)
#import <device_info/FLTDeviceInfoPlugin.h>
#else
@import device_info;
#endif

#if __has_include(<file_picker/FilePickerPlugin.h>)
#import <file_picker/FilePickerPlugin.h>
#else
@import file_picker;
#endif

#if __has_include(<firebase_auth/FLTFirebaseAuthPlugin.h>)
#import <firebase_auth/FLTFirebaseAuthPlugin.h>
#else
@import firebase_auth;
#endif

#if __has_include(<firebase_messaging/FLTFirebaseMessagingPlugin.h>)
#import <firebase_messaging/FLTFirebaseMessagingPlugin.h>
#else
@import firebase_messaging;
#endif

#if __has_include(<firebase_remote_config/FirebaseRemoteConfigPlugin.h>)
#import <firebase_remote_config/FirebaseRemoteConfigPlugin.h>
#else
@import firebase_remote_config;
#endif

#if __has_include(<flutter_downloader/FlutterDownloaderPlugin.h>)
#import <flutter_downloader/FlutterDownloaderPlugin.h>
#else
@import flutter_downloader;
#endif
1

There are 1 best solutions below

3
On

While "module not found" issue in a Flutter project when using Xcode. This issue typically arises when Flutter plugins or dependencies are not properly integrated with the iOS side of the project. Follow these steps to resolve the problem:

flutter clean

This command is used to remove any temporary files, caches, and build artifacts generated by Flutter. Running this command ensures a clean build environment for your project, which can help in resolving certain issues.

gem install cocoapods --user-install

This command installs the cocoapods gem locally in your user directory, which allows you to manage and install CocoaPods dependencies without requiring administrative privileges. The --user-install flag ensures that the gem is installed in a directory where you have write permissions, avoiding potential permission issues.

pod repo update

This command updates the local CocoaPods repositories. CocoaPods is a dependency manager for iOS projects, and it uses various repositories to fetch the required dependencies. By running pod repo update, you ensure that the dependency information is up-to-date, which can help in resolving issues related to missing or outdated dependencies.

pod install

This command is used to install the CocoaPods dependencies specified in the Podfile. The Podfile is a configuration file used by CocoaPods to define the dependencies required by the iOS part of your Flutter project. By running pod install, you ensure that all the specified dependencies are downloaded and integrated into your Xcode project.

By following these steps, you are addressing potential issues related to dependencies and project configurations, which can help in resolving the "module not found" issue in your Flutter project when working with Xcode. After completing these steps, try building and running your project again to see if the issue is resolved.