Flutter iOS App stuck or fails? What to Do? - ios

What to do when the Flutter app gets stuck on launching or installing dependencies or it fails out of the blue. I have noticed this issue coming up more and more in iOS. Android has its own issues. but a basic flutter upgrade or flutter pub upgrade can cause a lot wastage in developer time as the app will refuse to Build after some of the previously mentioned actions.
Track the list of items one can do to fix the unexpected long build times and build failures

I have been working with flutter for a while and there are few things which I believe can be done to get out of a bad flutter build situation.
Problems being considered
Stuck on flutter clean.
Stuck on flutter run.
Build Failure on Flutter pub upgrade.
The below mentioned solutions were performed and it has solved the problems for me in the past and I very well understand this is not a very clear solution but it still would be worth trying as it solved the issue for me in most cases.
Listing down few of the commands or actions which helped me in solving the issues.
Note: These are mostly related to solving the issues in building on iOS
flutter upgrade.
flutter pub cache clean.
flutter pub cache repair
flutter clean.
Deleting .dart_tools
Deleting Runner.xcworkspace.
Deleting .symlinks
Deleting Pods/
pod deintegrate(inside iOS folder)
pod cache clean --all.
pod repo update
pod update
pod install
if nothing works then
update the bundle identifier.
Delete iOS folder, run flutter create app with the bundle id and copy the iOS folder to project

Related

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.

Flutter ios No podspec found for `flutter_keyboard_visibility_web` in

Iam using Flutter in Mac -> Android studio and when I write pod install in the terminal. It show me
Analyzing dependencies
[!] No podspec found for `flutter_keyboard_visibility_web` in .symlinks/plugins/flutter_keyboard_visibility_web/ios`
Iam using flutter from one year ago, It is the first time it happen for me.
I cannot run the app. I dont have a plugin with this name flutter_keyboard_visibility_web in pubspec
How to fix it, thanks
The solution is:
1- Delete Podfile and Podfile.lock from ios folder
2- Flutter clean either from terminal
or from Android studio -> Tools -> Flutter -> Flutter Clean
3- Pod install
4- Run the app
The solution is here:
https://github.com/MisterJimson/flutter_keyboard_visibility/issues/52
I had the same issue, but I cleared cache on IntelliJ and it started working again.
To do this on IntelliJ:
From the main menu, select File | Invalidate Caches / Restart.
In the Invalidate Caches dialogue, select an invalidate the caches and restart the IDE.

Multiple dependencies error during build on iOS

I'm trying to build my nativescript app on iOS.
I have brand new MacMini with fresh system and all stuff like xcode, etc.
My app builds without any warnings on android - not checked android build on Mac.
When i try to run my app on emulator i have an error saying:
Analyzing dependencies
[!] There are multiple dependencies with different sources for `Socket.IO-Client-Swift` in `Podfile`:
- Socket.IO-Client-Swift (from `https://github.com/triniwiz/socket.io-client-swift.git`)
- Socket.IO-Client-Swift (~> 12.1.3)
'pod install' command failed.
Tried to remove one of the dependency from pod file but without any luck - it brings back during build.
What should i do?
After updating my dependencies, I also ran into an issue with Cocopods, although, not exactly the same. In my case, running pod repo update from within platforms/ios solved my problem. In short, there had been updates that my local pod spec repo wasn't aware of and it was getting "confused". I'm not sure if this will ultimately solve your specific problem, but it's fairly quick to do and, at least, won't hurt anything.
Good luck!

Build fail for google-signin package in react-native?

I am trying to implement react-native-google-sigin package to my react-native Ios project . I have configured everything.
But now the problem if I include google framework to my project there is a pop an error and As soon as I remove it. It works!!
I really don't know why m getting build fail with the following error
Every time i include ios/GoogleSdk frameworks in my project.
I don't know why or how but I ran into this issue and after numerous cleans, DerivedData deletes etc., the solution that worked for me was to follow XCode's advice on upgrading to the recommended settings and changing the iOS Deployment Target of RNGoogleSignIn project to 8.0. I'm using XCode 9 if that helps.
This is how I solved this:
rm -rf node_modules/ ios/
(Copied my podfile to another location)
npm install & react-native upgrade
(this will give me a error free start cause by react-native link)
cp my podfile inside ios/ Pod install
Followed the remaining steps from react-native-google-signin
Added the following to my login.js (iosCLientId and CLientId are different Id's)
await GoogleSignin.configure({
iosClientId: 'iosClientId',
webClientId: 'webClientId',
offlineAccess: false
});
Open Xcode Clear and Build the project.
Note: I would have easily removed the googlesdk(frameworks), links and library . But instead I choose to get get a fresh start. Hope this helps anyone

Unable to compile ios app

I am currently trying to test my flutter app on iPhone so I installed intellij, flutter and all other stuff. Everything was going well except that I was unable to build even the demo flutter app on my Mac. In fact, when I run
$ flutter create project_name
It returns
Creating project project_name... Wrote 54 files.
Running "flutter packages get" in project_name...
Could not find a file named "pubspec.yaml" in "/Users/user/.pub-cache/hosted/pub.dart-lang.org/typed_data-1.1.3".
pub get failed (1)
I can neither run "flutter run" nor "flutter packages get" with the same kind of error, it seem's that the paths to flutter packages are always wrong but when I try in sudo mode I can run all of those commands but I cannot see any device.
Do you have any idea of what I can do to solve this issue ?
Flutter relies on Dart's Pub package manager to manage dependencies under the hood. Pub maintains a cache of downloaded packages in ~/.pub-cache. This cache appears to be at least partially corrupted in your case. The pub cache is entirely safe to delete; pub will re-download anything it needs.
The simplest bet is to delete the entire cache via rm -rf ~/.pub-cache. It's possible that just that one package is corrupt, in which case, you may be able to get away with selectively deleting just the one (rm -rf ~/.pub-cache/hosted/pub.dart-lang.org/typed_data-1.1.3).

Resources