module 'audio_session' not found - ios

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?

You should
1 . open "Runner.xcworkspace" in xcode , Not "Runner.xcodeproj"
2 . everything going well

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.

In my case, I had changed the platform :ios to '13.0', but my iOS Deployment Target was '9.0'. I left the two the same and it started working again.
Make sure platform: iOS version in pod file matches with deployment
info in Xcode
Source: thanhbinh84

For me, it build succesfully after I ran flutter clean.
flutter clean
flutter pub get
flutter build ios
It worked for me.

18 nov 2020. M1, macOS Monterey.
Have the same issue with audio_session, but only in iPhone 15 simulator.
Download previous version on iOS.
Run without any other hacks.

Related

xcodebuild error: "requested but didn't find extension point with identifier ..."

I'm using Xcode 13.3.1.
I'm trying to build a flutter application in Android Studio. It failed with the following error. To make it dead simple I tried just running xcodebuild which produced the same error as in Android Studio:
.oh-my-zsh git:(master) xcodebuild
2022-04-21 19:45:25.858 xcodebuild[32450:312401] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-04-21 19:45:25.859 xcodebuild[32450:312401] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
xcodebuild: error: The directory /Users/salahuddin/.oh-my-zsh does not contain an Xcode project.
Any idea what causes this error and how to fix it?
Please refer to the message, you can find out solution.
https://developer.apple.com/forums/thread/703233
SOLUTION (for me):
I had to first find the software update manually:
softwareupdate --list
This provided me with the following output:
Finding available software
Software Update found the following new or updated software:
Label: Command Line Tools for Xcode-13.3
Title: Command Line Tools for Xcode, Version: 13.3, Size: 718145KiB, Recommended: YES,
I then ran:
softwareupdate -i "Command Line Tools for Xcode-13.3"
(NOTE: You pass the "Label:" output as the string as yours could be different.
This command worked out for me: softwareupdate -d -a.
Reference: https://huckfinnsmoneytree.com/how-to-download-macos-updates-using-the-terminal/
I faced the same problem when updating the project with Flutter 3. After several attempts, the below solution worked for me.
I have deleted the podfile.lock file inside the ios folder and then run the below commands.
flutter pub upgrade
flutter pub get
cd ios
pod repo update > Actually, this was an error for me but ignored it
pod install
Also please make sure you are using the latest MacOS and Xcode.
I hope this will help someone else.
Looks like you need to install the Xcode command line tools, which you can do by executing the following command in Terminal:
xcode-select --install
This worked for me:
Completely turn off Bluetooth.
in ios/ folder of your project, change Podfile to
platform :ios, '12.0'
Run pod deintegrate in Terminal inside the ios/ folder of your project.
Run pod install --repo-update in your ios/ folder
https://solveforums.msomimaktaba.com/threads/solved-flutter-for-ios-run-build-but-not-archive.699314/
The error mentions that there's no iOS project to be found on the directory.
xcodebuild: error: The directory /Users/salahuddin/.oh-my-zsh does not contain an Xcode project.
You'd need to navigate to the iOS build of your Flutter project on your terminal with cd ios and run xcodebuild there.
multiple xcode.app you need to remove.(Download folder)
XCode-> Preferences-> Locations -> Command Line Tools
Check it shows multiple entries for same xcode version.
Delete xCode.app other than Application folder.
quit and restart xcode and terminal.
My issue was that I was using Xcode 13.4. I downloaded Xcode 13.3 from here and everything started working again.
I was encountering this issue on a self-hosted GitHub runner so in order for the fix above to work, I needed to:
Uninstall the Xcode 13.4
Remove the GitHub runner
Install Xcode 13.3
Re-add the GitHub runner
Try This.
Remove any command line tools:
sudo rm -rf /Library/Developer/CommandLineTools
Reinstall them:
xcode-select --install
Tell the system to use them:
sudo xcode-select -s /Library/Developer/CommandLineTools
If still not working, try that:
In Xcode > Preferences > Locations tab
Simply select the right toolset.

Flutter: error Xcode: command PhaseScriptExecution failed with a nonzero exit code

I tried to run flutter after updating to the newest stable version
Error output from Xcode build:
↳
** BUILD FAILED **
Xcodes output:
↳
Writing result bundle at path:
/var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle
/usr/local/Caskroom/flutter/2.5.2/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/lib/src/interface/local_platform.dart:46:19: Error: Member not
found: 'packageRoot'.
io.Platform.packageRoot; // ignore: deprecated_member_use
^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
Result bundle written to path:
/var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 13 Pro.
I've tried flutter clean and flutter pub get but that isn't the fix. Anyone any idea how to fix this?
As i see you are currently using flutter 2.5.2 which is newest,So Update you flutter SDK by running command
flutter upgrade
Then Upgrade the current package's dependencies to latest versions by running command
flutter pub upgrade
Go to iOS folder of the project run
pod init
and
pod install
I hope this solution solve your problem.
Please up the vote if this answer help you.
I spent way too much time on this issue.
For me the problem was related to the Flutter cache and running the following command resolved the issue:
flutter pub cache repair
The solution made sense to me when I noticed a plugin trying to reference [flutter-sdk-path]/flutter/packages/flutter/lib/screens.dart--which did not exist in my Flutter SDK.
Ref: Update flutter dependencies in /.pub-cache
Guys, sometimes it better to just GO TO SLEEP! It helps a great deal to have fresh eyes looking at a problem.
if you have Podfile in iOS folder
Go to iOS folder of the project
run
flutter clean
and
flutter pub get
and
pod update

importing "Module 'app_settings'" not found

I'm currently trying to work with xcode to test my flutter application with xcode. The big issue is that all of my imports (such as app_settings, cloud_firestore, etc...) give an error for "Module ___ not found". When I try to run my dart code I get the error in the terminal:
[Proj Root]/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'app_settings' not found
#import app_settings;
~~~~~~~~^~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
I tried running flutter create for ios, (this might've made things worse?) Flutter clean and reinstalling pods doesn't seem to work either. I'm wondering if there's something simple that I missed with importing modules. I created the application on android using modules that should work with Android & iOS. After getting the android version working I pulled my project on my mac through github and finally reached this issue. Any pointers would be appreciated because I'm totally stuck on this.
My project has 3 build flavor. Development, Staging & Production.
In Xcode It was selected default Runner One. (On Top of the middle)
though i follow the process like
delete pod , Podfile.lock and .symlinks from Android Studio / (From Project)
flutter pub get
cd ios > pod install
Then In XCode > clean build
Select Right Build Flavor (Production For Me)
Then Archive (Done)
NB: I tested in M1 machine.
Hmm Not sure what happened but it seems to be good now. I think pod init was initializing minimal data for the podfile. Instead, I deleted the Pods file and did flutter run and it built the podfile correctly with flutter pub get.
Had the same problem, we solved it by setting the iOS Deployment target in XCode to the same value as set in the Podfile, which was 12.0. Then ran flutter clean and flutter build ios worked like a charm 🎉
I had this same problem. What I did was
Delete the Podfile and Podfile.lock
flutter clean
flutter build ios
Opened the Runner.xcworkspace
Build on Xcode
This worked for me 🎉
Delete pod directory and podfile.lock
flutter clean
flutter pub get
cd ios
pod install --repo-update
run the application in Xcode
I tried everything above, but for me the solution was quite different.
I am using flavors (schemes), and I accidentally created the scheme with upper case in the first character, while everywhere else (build config etc.) I used lower cases only. After deleting the scheme and recreating with lower case characters, it worked.
path/flutter/ios/Runner/GeneratedPluginRegistrant.m:12:9: Module 'app_settings' not found
I had the same issue after upgrading the Xcode to 13.3 and my production build flavor wasn't working. I was using firebase as well. In my production build flavor, I didn't append anything to the configuration name (i.e. all the other configurations have the name like "Debug-staging", "Debug-development", but in the production, it's only "Debug"). I just deleted the pod file and run:
flutter run --flavor production --target lib/main_production.dart
Everything worked fine for me.

How to fix cocoa pods flutter bug?

I am trying to run several dependencies on my flutter project however end up always getting the same error while running the project on ios and the full terminal message looks like this:
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/username/Desktop/flutter_test/xylophone/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'assets_audio_player/AssetsAudioPlayerPlugin.h' file not found
#import <assets_audio_player/AssetsAudioPlayerPlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.
Launching lib/main.dart on iPhone X in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.dev/platform-plugins
To install:
brew install cocoapods
pod setup
Xcode build done. 5.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Exited (sigterm)
This occurs with every dependency that I try to use from the flutter packages and I really don't know how to fix this. The process of installing cocoapods also doesn't work.
This has an existing GitHub issue. The error you've encountered was because the time you've installed cocoapods, it was installed with different version of ruby than you currently have active.
The recommended way to fix this is to to uninstall your existing cocoapods brew uninstall cocoapods and install a fresh one, via sudo gem install cocoapods.

Flutter - <Flutter/Flutter.h> not found when using the google_sign_in library

I am facing this issue while compiling the app for ios
this is the whole stacktrace:
Launching lib/main.dart on iPhone Xs Max in debug mode... Running pod
install... Running Xcode build... Xcode build done.
2,4s Failed to build iOS app Error output from Xcode build: ↳
** BUILD FAILED **
Xcode's output: ↳
=== BUILD TARGET FirebaseAuth OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/danielec/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.0.1+3/ios/Classes/GoogleSignInPlugin.m:5:
/Users/danielec/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.0.1+3/ios/Classes/GoogleSignInPlugin.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import
^~~~~~~~~~~~~~~~~~~
1 error generated.
I tried reinstalling both firebase_auth and google_sign_in, removing and reinstalling cocoapods, I don't know what else to do, as any one experienced this problem before?
Versions:
Cocoapods: 1.6.1
firebase_auth: ^0.8.4+5
google_sign_in: ^4.0.1+3
I had a similar issue, while using Flutter on the stable channel. While running on iOS simulator I started to get this error: /[pathto]/Flutter/testtwo/ios/Runner/GeneratedPluginRegistrant.h:8:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
The only thing that helped was to change the channel to beta (I actually tried to run there and it worked) and then back to stable but also pub upgrade. See below the sequence of commands. Note that after changing to a channel you need to wait to Flutter to do the build (it took several minutes for me):
flutter pub upgrade,
flutter channel beta,
flutter clean,
run app successfully... on iOS.
flutter channel stable,
flutter clean.
I hope it helps.
I had the same , I don't know what happened but my solution was :
Create a backup "iOS/Runner" plist is especially if you have some permissions or other thing stuff that..
After that in console write : flutter create .
.. that create one more time your iOS folder, apparently some files inside iOS are corrupter for some ¿bug?..
ahh too,, very important , open Xcode and not copy the file googleservices.json, you need take the file and put inside runner files (NO COPY!!)
don't forget flutter clean and restart invalid android studio.
good luck!
This is what worked for me.
Delete your .pubcache folder, you can find it where you installed flutter to (you can run "which flutter" if you are not sure where) it is usually a hidden file so you would have to enable your settings to show hidden files (shift + Command + full stop to show hidden files on Mac).
Run "flutter clean" in your terminal (ensure build folder is removed)
Delete symlinks, pods and podfile.lock from the ios folder
Delete your pubspec.lock file
Build again
If you are still having issues you can go further
Downgrade Flutter with "flutter downgrade"
flutter pub cache repair
delete Generated.xcconfig from ios/Flutter directory
pod install (from the ios directory)
build again

Resources