Flutter: Fix module not found on iOS build

Fix module not found when trying to build your Flutter app for iOS

Problem

You are trying to build your Flutter app for production on iOS. Everything is fine until you get an error like:

ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module
    'assets_audio_player' not found
    @import assets_audio_player;
     ~~~~~~~^~~~~~~~~~~~~~~~~~~
    1 error generated.

Solution

Ensure that these two version settings are the same in your Xcode setup and Podfile:

  • Xcode: Runner -> General -> Deployment Info -> `iOS 'version'

Default Alt Text

  • Podfile: config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'

Default Alt Text

Conclusion

Now when you try to build, it should be all good.

Hope this helps!

Comments: