module 'audio_session' not found
Solution 1
Finally, found a solution.
Somehow, If I went to the iOS folder of my flutter project and type 'pod init; pod install' a basic Podfile was generated (meaning that it had specified only the platform).
I found a post somewhere that suggested to delete everything in the iOS folder about pod and to run flutter run in the project. Running 'flutter run' in the project folder (that integrates 'pod install' as well), generated a much detailed Podfile, but this time I faced another error in regards with the platform (listed below).
Error output from CocoaPods:
β³
[!] Automatically assigning platform `iOS` with version `12.0` on target
`Runner` because no platform was specified. Please specify a platform for
this target in your Podfile. See
`https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error: To set up CocoaPods for ARM macOS, run:
arch -x86_64 sudo gem install ffi
I tried to follow the suggestion to run the command shown above, but the same error occurred.
Then, I found an answer here Running Cocoapods on Apple Silicon (M1) that is similar with the official documentation https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon.
Even so, the answer from the stack overflow didn't work straight forward for me until I followed these steps:
- Open finder -> Utilities
- Right click on the Terminal -> Get Info
- Check 'Open with Rosetta'
- Open a new terminal and type 'gem uninstall cocoapods'
- sudo gem install cocoapods
- gem uninstall ffi
- arch -x86_64 sudo gem install ffi
I hope this is useful for someone else.
Solution 2
You should
1 . open "Runner.xcworkspace" in xcode , Not "Runner.xcodeproj"
2 . everything going well
Alexandru Rusu
π I am a Senior Flutter Developer / Consultant / Contractor / Freelancer π°π’ππ‘ π+ π²πππ«π¬ π¨π ππ±π©ππ«π’ππ§ππ, using my expertise to identify & implement clientsβ needs with regards to their software solutions. About my skills: β’ Cross-Platform: Flutter, Kivy β’ Backend: Dart, Python, C, Linux, Firebase, Docker, Algorithms β’ Software Architecture: Domain-Driven Design, Test-Driven Design, Clean code, Microservices, Unit testing β’ Leadership: People and Communication skills, Planning, Ability to teach and mentor π Only interested in remote work. π© Drop me a message if you think my expertise could help your organization! π Phone: +40 768 050 010 π§ Email: [email protected] π¬ Skype: agrusu_1
Updated on December 06, 2022Comments
-
Alexandru Rusu over 1 year
I try to build an existing flutter project on a new Mac with M1 chip. I face the following error in regards that the audio_session module is missing.
Launching lib/main.dart on iPhone 12 in debug mode... Running Xcode build... ββCompiling, linking and signing... 340ms Xcode build done. 4.7s Failed to build iOS app Error output from Xcode build: β³ objc[7636]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f2fe0188) and ?? (0x117e8c2b8). One of the two will be used. Which one is undefined. objc[7636]: Class AMSupportURLSession is implemented in both ?? (0x1f2fe01d8) and ?? (0x117e8c308). One of the two will be used. Which one is undefined. ** BUILD FAILED ** Xcode's output: β³ /Users/user/Projects/myproject/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'audio_session' not found @import audio_session; ~~~~~~~^~~~~~~~~~~~~ 1 error generated. note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description Could not build the application for the simulator. Error launching application on iPhone 12.
Any thoughts?
-
Ranjit Shrestha about 3 yearsmake sure you have added
audio_session
package inpubspec.yml
file. after then run the commandflutter pub get
andflutter run
-
Alexandru Rusu about 3 yearsI don't use this package at all. I think somehow it is a dependency.
-
Alexandru Rusu about 3 yearsI cleaned the pod file and I figure out that 'flutter run' generated a more complex Podfile. Anyway, another error is generated Error: To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi Even if I run the command that was mentioned, the same error occur.
-
kohjakob about 3 yearsRunning into the same problem. I'm using just_audio which depends on
audio_session
. -
kohjakob about 3 yearsOkay, I think my problem was opening
ios/Runner.xcodeproj
instead ofios/Runner.xcworkspace
. More on that here -
Alexandru Rusu about 3 years@kohjakob, check my answer below.
-
-
Alexandru Rusu almost 3 yearsIn my case I used the terminal to build, by running
flutter run
. I already posted an answer down below. -
capdev almost 3 yearsokay , i got same question other day , and cause i open "Runner.xcworkspace" in xcode
-
Sandz about 2 yearsAny solution to this?? I opened Runner.xcworkspace...but still get this issue