Flutter module not found in Xcode

Viewed 59113

When I build the app in Xcode it throws the error: .../ios/Runner/GeneratedPluginRegistrant.m:10:9: Module 'audioplayers' not found I tried reinstalling and setting up pods again, however it didn't work. I am also including pod 'Firebase/Core' in the pod file. Maybe I need to include the Audioplayer module there as well? Thanks in advance!

25 Answers

Make sure platform: iOS version in pod file matches with deployment info in Xcode

enter image description here

Did you make sure that you started xcode by double clicking the "runner.xcworkspace" from your "project/ios" folder and not "runner.xcodeproj"?

According to this source, it solves the "missing module" issue for a lot of people (As it did for me). https://github.com/flutter/flutter/issues/41033

  1. Delete Podfile
  2. flutter clean
  3. flutter pub get
  4. flutter build ios

It works for me!

I got same error with Better Video Player. Make sure your IOS Version in Pod File is 11. 1st make sure you are opening runner.xcworkspace If issue is still present then try this step.

1.- flutter clean
2.- flutter pub get
3.- cd ios
4.- pod deintegrate
5.- pod install

If issue is still present then

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
    end
  end
end

Make sure that the selected scheme to run is "debug"

  • Click "Runner" which is just near the simulator dropdown.
  • Edit scheme.
  • Select "Run" at the left list.
  • Select "Debug" for "Build Configuration"

I had a similar issue with the following compiler output:

/Users/me/flutter_project/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'barcode_scan' not found
    @import barcode_scan;
     ~~~~~~~^~~~~~~~~~~~

My project contains multiple build environments with Flutter flavors as described here: https://medium.com/@thomasgallinari/e7a0c973f54e

What solved the issue for me is changing the casing of the build configurations and the corresponding files from values like Debug-stage to Debug-Stage as the latter is expected by Flutter.

On mac with m1

1.- Delete Podfile

In Android Studio:

2.- flutter clean
3.- flutter pub get
4.- cd ios
5.- pod install

An then

6.- Build and run your app through Xcode

this worked for me.

For me (Mac w/ M1) I ran the following:

  1. flutter pub get
  2. cd ios
  3. rm -rf Pods/ Podfile.lock
  4. pod install

After this, running application within xcode worked as expected.

If you run the program through Xcode, make sure that you have opened the Runner.xcworkspace file in XCode, not the Runner.xcodeproj file

Nothing worked in my case. I was able to run the project from VSCode but I couldn't archive on XCode. I've solved via choosing the scheme.

Yes, scheme. This project have 3 different flutter flavors, a.k.a iOS schemes. I realized I can't even list the devices or simulators for this project. Issue was, I didn't choose the scheme instead of it was on default one, Runner.

By nothing, I mean everything. I've deleted podfile, podfile.lock, I've changed deployment targets, I've deleted pods folder, I've added post scripts to update dependencies to 9.0, I've tried flutter clean and pod install --repo-update.

Issue simply was not choosing the right scheme.

go ios folder "cd ios" and run "pod install" and run again

In my case, I missed changing the scheme configuration (for the build, run, test, profile, archive) to the prod after adding flavors (they were set up to old configurations)

Try this simple steps it worked for me

  1. Delete pod directory and podfile.lock

  2. flutter clean

  3. flutter pub get

  4. cd ios

  5. pod install --repo-update

  6. run the application in Xcode

Delete podfile & podfile.lock & pods folder & .symlinks folder and than flutter clean and pubget and run again

It works for me.

That can happen if you use M1 Chip Mac and using older flutter versions, i had to install all pods using Rosetta. Go to terminal -> right click -> info -> use Rosetta.

For me, I had the same issue for different packages, it got resolved after changed the debug device to my real iPhone instead of the simulator.

in my case, it was an issue with the firebase, firestore document. just make sure to update all libraries, like firebasecore, firebaseauth, analytics, etc to the latest version.

why it is showing the error of audioplayers?

because it is stated at the first position among all libraries.

means there is no issue at my side for audioplayer. after updating all libraries I just install the app.

if you still face a problem make sure to flutter clean then pod install. then run the app.

yes sometimes codes run on android but not run on ios. for that you have to update the libraries.

Hello if you try all the ways above and can't solve your problem you can check. on your Scheme -> Edit Scheme... -> Build Configuration

In Build Configuration select box => check your config name is the right config you have. In some cases it's missing the "-" character and you need choose the right config.

Then close and rebuild your project.

I have tried many things like delete the pod file and podfile.lock, flutter clean, reinstall cocoa pods, changing scheme, but nothing worked for me until I tried to change different version numbers (Ex: 8, 9 etc.) And finally when I changed from 8 to 10 (platform :ios, '10.0') in Pod file it worked. I think some libraries are not supporting some platform versions. For my project 10th worked. If you have the same problem try to change different platform :ios versions in podfile one by one, hope this will help.

NOTE: The platform :ios version in podfile should be same with the IOS Deployment Target in XCode -> Project Runner under Info tab otherwise it fails

Make sure that ios version on podfile and development info be same

If you tried everything but error still appears, make sure that your path to project doesn't contains whitespaces. Sometimes Xcode can't deal with it. And make sure that you have the latest Xcode and MacOS version.

in my case the Pods not downloaded, because of Cocoapods version is not suitable (i am using apple silicon but using arm Pods). Reinstall Pods and using the proper version.

First open terminal and do this

sudo arch -x86_64 gem install ffi

the move into folder IOS folder and run this

arch -x86_64 pod install

I also ran into this problem when launching the app with the simulators. After trying all above methods, it is still not fixed. I used the cable and run the app with my phone. And it worked like a charm. I hope this helps.

delete the podfile and run "flutter create ." (it will modify a new podfile)

Related