flutter: "fatal error: module 'location' not found" Xcode cannot found modules

Issue

I tried using the geolocator to get the current position, but Xcode (on M1 Mac/ arm64 ) was unable to detect the module. After some research, I simply changed the plugin and integrated the recommended pub locator. After that, however, the same error still occurs. This module is also not found.

↳
    objc[7998]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x1eab43130) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1080f02c8). One of the two will be used. Which one is undefined.
    objc[7998]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x1eab43180) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1080f0318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/campermike/Documents/projects/cnow/ios/Runner/GeneratedPluginRegistrant.m:18:9: fatal error: module 'location' not found
    @import location;
     ~~~~~~~^~~~~~~~

Solution

I got similar error recently so follow my approach if you want save your time.
You need to crate new project with same bundle id in your m1 Mac machine and just replace your codes & ios & Android mandatory files. Because all errors are architecture related.

But before this please do following things:

1.Remove pub cache.
2.Flutter clean
3.Remove xcode derived data.

Answered By – Vishal Zaveri

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.