Module 'connectivity not found' in iOS build of Flutter application - ios

I have been trying to build my flutter app in iOS simulator but getting build error with following screenshot.
Where my Xcode version is 11.0, CocoaPods version 1.9.3, Flutter version 1.22.0
I have also upgraded connectivity package from 0.4.9+2 to 0.4.9+3 which is latest one. Following some steps by googling but no one is working yet. However my android build is fully ok.
Thanks in advance.

I have solved this issue through running this command in terminal at Project folder directory
rm ios/Podfile && flutter build ios

I solved this problem by setting in the podfile
platform :ios, '12.1'
And then later inserting the same version in Xcode as well

For me, it turned out that I was opening ios/Runner.xcodeproj instead of ios/Runner.xcworkspace.
Opening ios/Runner.xcworkspace from Xcode worked for me!

Alternatively, go to your flutter appname/ios folder and type in commandline:
sudo gem install cocoapods
flutter pub get <---may or may not be necessary for you
pod install
This will install the infuriating cocoapods to your project

If you are working with flavoured build, e.g staging, production, development.
Your app will most likely be running on Runner so click on runner and select the correct build build flavour which in this case would be one of the flavours.

I have this issue and this sequence of steps have worked for me.
Go to the ios folder #cd ios
Delete the Podfile #rm Podfile
Run flutter clean
Run flutter pub get
Case you need generate files with build_runner #flutter packages pub run build_runner build --delete-conflicting-outputs
Build for app for iOS. #flutter build ios
Generate your project pods. #cd ios && pod install
Build project from XCode

In many cases it comes because of difference between Pod install version in flutter and Xcode. Just check them or simply add 'platform :ios, '11.0'' to your podfile in flutter.

rm ios/Podfile && flutter build ios
Change the platform number on Podfile "platform :ios, '12.1" (in XCode: Pick 12.1v.--> Runner > info IOS Deployment Target: 12.1)
Open the flutter ios folder (right-click on ios folder in vs. code and click "Open in Xcode")
Go to Product > Schemes > New Scheme
Select the name of your Cocoapod, then click OK
build again

it's mean som dependencies missing on project. I solved same problem by this step.
cd /YourProject/iOS
rm Podfile
flutter clean On your IDE
flutter pub get
And cd /YourProject/iOS
pod install

in xode clear build and close xcode
and
run this in project folder.
flutter clean && fluttter pub get && cd ios && rm ios/Podfile && cd .. &&flutter build ios
open xcworkspace instead of xcodeproj.
build the project

Related

Error in Xcode 12.5.1 while building, (error spawnSync xcodebuild ENOBUFS)

I was running react-native project in Xcode v12.4, now I shifted my code to v12.5.1. It is giving me above error, when I build my project. What should I do?
I have googled around but not found this error regarding iOS and Xcode.
If you don't have cocoa pods installed you need to by command sudo gem install cocoapods and run following commands from your project main directory
From your project remove Pods and Podfile.lock from ios directory after that re install pods
cd ios && pod install && cd ..
Run your project again

Module 'path_provider' not found

I have used several times the Xcode simulator for my flutter app.
One time I tried to change the simulator to iPhone 11 Pro (don't know if it did or did not cause the problem) but since then:
I get the error Module 'path_provider' not found.
It seems that each time when I double click on the Runner.xcworkspace file, it opens the project file instead. I'm new to Xcode so not quite sure about that but I attached a screenshot.
Things I've tried:
updated according to the instructions in the warnings (which can be seen in the screenshot).
deleted all Xcode cache with Reset Xcode
deleted the android studio project and popped it again from git.
flutter clean + removed all the pod files + pod install from android studio terminal.
according to the explanations here: reinstall pod
What else can I do?
I had the same issue. All I had to do was open the runner.xcworkspace instead of runner.xcodeproj and run the app.
I faced this same error and realized that I have used pod init manually so I deleted the Podfile in the ios folder then run flutter build ios.
The Flutter will generate the Podfile correctly and everything works well after that.
The problem for me, as it seems, was that the Xcode opened "Runner.xcodeproj" instead of "Runner.xcworkspace"
from what I understood, .xcworkspace is the one that makes the bindings/connections between files and packages. xcodeproj doesn't do it and that's why it was missin although I did have it.
Solution:
To be sure I do have the updated version of the missing package:
cd [project path]
Flutter clean (or delete the build folder to ensure there is no cache)
cd [project path]/ios
pod install
pod update
Then, when opening the Xcode I clicked:
Project navigator (folder icon on the left toolbar) -> Runner (in the project tree that opened) -> Runner (under Targets)
(shown in the attached picture)
and then when I build it worked for me.
In Podfile, I just comment platform :ios, '11.0', it worked!
I had the same problem that was caused by the linker.
I solved it as follows:
runner->build setting->other linker flags, and delete path_provider
My technique is basically to rip it up and start again - keeping all the lib files though! That way you can keep track of what you need to do to fix the things you broke trying to fix it earlier !
I create a new flutter project and add the lib files from the broken project. then piece by piece put it back together.
I decided on this idea after trawling through many 'patches' to the specific errors that I saw. I should not have been anywhere near those errors - so patching them just broke more - untraceably. Hence the rebuild.
In Flutter project, I Also faced with this issue. Fixed by updating flutter and cocoa pods to the latest version.
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter pub get
Move to podfile (project_name/ios/Podfile) and comment platform :ios, '11.0' like this # platform :ios, '11.0'
then run this commands
cd ios
pod install
arch -x86_64 pod install //(On an M1 mac use => arch -x86_64 pod install)
cd ..
flutter run

Xcode Build failed,fatal error: module 'firebase_auth' not found #import firebase_auth;

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.5 19F101, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.46.1)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
\\\Error Message
** BUILD FAILED **
Xcode's output:
↳
/Users/Razi/Desktop/projects/Sayy/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'firebase_auth' not found
#import firebase_auth;
~~~~~~~^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
I have tried deleting Podfile/Podlock and running pod init/ pod install without success. Also have reviewed the GitHub repo for ios folder. Why is firebase_auth not found?
Update: I was able to eventually find a workaround by executing the following:
Running Flutter Clean (in ios folder of project)
Deleting both Podlock & Pod Folder
Running pod init followed by pod install
seems to be an issue with the runner.xcworkspace folder and the build
files needed to run builds.
I tried to follow suggested steps of executing Flutter clean, manually removing podfile and podfile.lock along with Pod related folders, executing pod install again, etc. - nothing helped.
What helped me in the end was the following sequence:
Create a new project with same dependencies declared in the pubspec.yaml.
Run pub get in the new project.
Run pod install in the new project to get everything generated
Copy newly generated podfile and podfile.lock files to the old project.
Run pod install in the old project.
Only after this sequence I was able to build the iOS project again.
These steps helped me to resolve the issue completely for IOS:
>> flutter clean
then "delete podfile, podfile.lock, pod folder"
>> flutter pub get
>> pod install
>> flutter run
It seems like you provided not a full Podfile's content (I can't see anything about Sayy target there) or you've been changing Podfile
Depending on what you trying to archive either remove last 3 lines in Podfile or move line "pod 'AFNetworking', '~> 3.0'" to target 'Runner' right after 'use_modular_headers!'
open XCode toppest item in left sidebar (blue icon) -> in leftest menu you will see two sections — Project and Targets. So names that are in 'targets' block — is the only one that can appear in Podfile after keyword 'target'
everything depends on:
do you need AFNetworking?
what targets do you have in your application
I have got rid of this issue buy un-commenting the line in Podfile
platform :ios, '10.0'
Also delete clean your project and rebuild again!
Change the Deployment target for ios either in build settings-> Deployment in xcode or in podfile set deployment target greater than 10
Here's what worked for me
Find the latest version of firebase_core / firebase_auth on pub.dev
Clear your Pods/ and Podfile.lock in the ios folder
Run pod install --repo-update in the ios folder (IMPORTANT!)
Here are the steps which worked for me:
Delete ios > Pods
Delete ios > Podfile, Podfile.lock
flutter clean
flutter run
After executing these three commands in this order, pod install started, and it was done.

Module not found issue with package installed in flutter module (add-to-app)

I have flutter module added to the existing iOS app. Not all but few of the packages installed (via pubspec.yaml file) could not be found by the iOS app when compiled, and I'm getting 'Module not found' error in XCode. Those problematic packages are: razorpay_flutter, google_maps_flutter, webview_flutter, and url_launcher until now. Please have a look at screenshot below:
Same is the case with other 3 packages.
Steps to reproduce issue:
Add razorpay_flutter: ^1.1.3 in the pubspec.yaml file of the
flutter module
Run flutter pub get. The package will install
Run Xcode project to which flutter module is added. Got error!
One more thing I observed after step 2, that there is some warning regarding issue for add to existing app:
Running "flutter pub get" in lib_smazing...
The plugin `razorpay_flutter` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment.
It may have undefined behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
I guess there is issue with the packages using platform channel/code when added to an existing app, but not sure whether its package-specific issue or a flutter issue with add-to-app.
After few trials and error I found simply running pod install on iOS project directory fixed the issue.
Rather trivial but realized my packages were not found because I opened and executed the wrong file in XCode - so open Runner.xcworkspace and not Runner.xccodeproj
There are multiple solutions available for any kind of library/module not found.
Solution # 1
flutter clean
flutter run again
rebuild it from ios or vscode tool again.
if still problem
pod update
pod repo update
pod install
Solution# 2
delete build folder
delete pod.lock file
delete .syslinks folder
delete pods folder
change your directory in your terminal by
cd ios
pod install --repo-update OR pod repo update
pod install
flutter clean
flutter pub get
Solution# 3
please open Runner.xcworkspac with xcode because app will get local
lib from pod install lib that installed. , but don't Runner.xcodeproj

firebase_ml_vision breaks IOS build, fix for Windows machine

I have a windows machine and would like to build my flutter app for my Iphone. I am using codemagic.com to build my app. With the firebase_ml_vision dependency there is an error when building the app for iOS as seen here, https://github.com/flutter/flutter/issues/28625. I am not sure how to fix this on my windows machine because i am unable to access the iOS build files.
Here is the error message when building the app for iOS
Returning local
[!] CocoaPods could not find compatible versions for pod "firebase_ml_vision":
In Podfile:
firebase_ml_vision (from .symlinks/plugins/firebase_ml_vision/ios)
Specs satisfying the `firebase_ml_vision (from `.symlinks/plugins/firebase_ml_vision/ios`)` dependency were found, but they required a higher minimum deployment target.
If you are using firebase_ml_vision: ^0.10.0 or up, you have to change your Deployment target to 10.0:
In your Podfile: platform :ios, '10.0'
In your Xcode project set iOS Deployment Target to 10.0
Then, run the following in your terminal to build with a fresh state:
flutter clean \
&& rm ios/Podfile.lock pubspec.lock \
&& rm -rf ios/Pods ios/Runner.xcworkspace \
&& flutter build iOS

Resources