@import geolocator: Module 'geolocator' not found

Viewed 1452

I created a Flutter project on the MacBook using Android Studio. The App works correctly on the Android phone and also on the iPhone connected to the Mac but when trying to generate the upload file for Apple it presents the error referenced in the GeneratedPluginRegistrant.m file

//// Generated file. Do not edit.//
#import "GeneratedPluginRegistrant.h"
#if __has_include (<geolocator / GeolocatorPlugin.h>)
#import <geolocator / GeolocatorPlugin.h>
#else
@import geolocator;
#endif
#if __has_include (<google_maps_flutter / FLTGoogleMapsPlugin.h>)
#import <google_maps_flutter / FLTGoogleMapsPlugin.h>
#else
@import google_maps_flutter;
#endif

Error: @import geolocator: Module 'geolocator' not found

I noticed that if you remove the part of the code that contains this call, the error will pass and be displayed on the next import, implying that everyone will have errors.

Could anyone help?

2 Answers

I was also getting an error just like this while archiving the build.

module 'geolocator_apple' not found

After a lot of searching, I found out it was due to the different iOS Deployment Target in Podfile and in Xcode's Project Runner.

I made both same, it worked happily after.

Here are screenshots of both now after correction.

ios version in my Podfile

ios version in my Podfile

ios version in Project Runner

ios version in Project Runner

For some reasons, the module related pod was not installed. You may want to go to the project ìos folder and type (from the terminal): pod install. This should install the missing files and you should be able to build and run your project without any issue.

Related