Can't get Flutter project running after cloning from GitHub - ios

I'm new to Flutter and have been learning it recently. Been trying to get this flutter app running for my internship, but can't seem to figure out why it's not running. I have no problem getting the default flutter app running on both iOS and Android simulators and on my personal iPhone. Flutter doctor checks out fine. I’ve tried flutter clean, removing the Podfile (as it recommended because it said it was out of date), downgrading flutter to the same version my team was using because I was thinking maybe it was a problem with that working with Xcode 12, and running things like pub get and pod install. Same error all around when trying on Xcode, terminal, android studio, and VScode. I've been pretty much going in circles with the same errors trying different things.
I'm running the app with the following command: flutter run -t lib/main_dev.dart --flavor dev
The third image is the error I got after I tried the first solution on Stackoverflow.
The fourth image is when I try running the app on my android sim.
I've tried the following answers here in Stack overflow
First solution
When I was getting deployment warnings
I could go on with the bunch of different errors I've encountered trying to run on Vscode, android studio, and so on, but basically, I've been going in circles with the same errors and the images below are just the ones I'm encountering now. All I'm trying to do is run the project I cloned from Github. I'm hoping anyone here will find an error that looks familiar to them or a similar situation where they couldn't get a flutter project to run after cloning.

A word of advice, Always run the latest flutter engine unless it is absolutely necessary.
run flutter clean
run rm ios/Podfile ios/Podfile.lock pubspec.lock
Looks like your flutter svg package has to be updated

Related

React Native, iOS, trying `yarn run ios` and I get RCTAppDelegate.h not found

Trying to build a React Native iOS app, and while I got it running fine using Android, trying to get it running on iOS has been a bit of a nightmare.
I created this base react native app, back in Sept 2022, doing the typical npx react-native init <projectname> and was working on android mostly (I use a linux box, and I have to use Teamviewer to connect to a mac to build the iOS apps).
I had my app working fine in android and iOS, and then added the Zoom Video SDK and everything went to hell. Got it working fine in Android, and tried to take my changes and build them in iOS but I couldn't get it to work, and seemingly got my iOS project corrupted, so I tried to create a fresh iOS project, by basically created a same-named project in a different directory, and replacing the <projectname>/ios with the new base ios project.
Of course, I did this Jan 2023, so it's the new architecture, and the AppDelegate.h tries to import the RCTAppDelegate.h file instead of React/RCTBridgeDelegate.h
I do my usual yarn install go into the ios directory and pod install and then try to do a yarn run ios and it tells me it can't find RCTAppDelegate.h
Anyone solve this yet? The React-Native docs aren't up to date with their github repo
I got the same error, i solved it by opening the .xcworkspace instead of opening .xcodeproj
I also cleaned the build folder by
Product --> Clean Build folder
and then it successfully built the app.

Xcode commands are taking a long time within Flutter projects

Some context
I'm working with Flutter, but after doing a couple of changes to the iOS Podfile, .plist files, and Runner.xcworkspace things "stopped" working. The problem I'm having is that everything Xcode related is taking a very long time to run in all of my Flutter projects.
To give some context the app I was building when Xcode started giving me problems uses Cloud Firestore. For this to compile faster I added the following code to my Podfile, this was suggested by Google in some docs.
platform :ios, '16.1'
target 'Runner' do
# Code to reduce compile time for iOS.
pod 'FirebaseFirestore/WithLeveldb', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.2.0'
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
After doing this change and importing the Firestore package a file called GoogleService-Info.plist was created and I added this file to the Runner.xcworkspace as a Runner. This step was mentioned in another Google document for activating sign-in with Google.
A weird thing about all of this is that if I try to run open Runner.xcworkspace the Xcode app also takes forever to open (it's been over an hour since I ran it and it has not been opened). This worked earlier as I was able to open this directory to make the aforementioned change (make GoogleService-Info.plist a Runner file).
Attempts to solve this
After identifying the error I tried doing the following things, but nothing has worked so far:
Uninstall Xcode Command Line Tools and install them back on.
Uninstall Flutter and install it back on.
Uninstall Xcode completely and install it back on.
Restart my computer.
Try to build the project in another computer, but now this other computer is having the same issue.
I've tried to run things on both an Intel-based Mac and an Apple Silicon Mac, but in both computers Xcode "stopped" working for Flutter.
Reproducing this problem
The problem occurs when I try to run flutter clean, flutter run, or open Runner.xcworkspace. After running the first two commands in --verbose mode the problem comes up when the following commands appear:
xcrun xcodebuild -list
xcrun xcodebuild -workspace $PATH/Runner.xcworkspace -scheme Flutter Assamble clean
xcrun xcodebuild -workspace $PATH/Runner.xcworkspace -scheme Runner clean
The first command is currently running on the Apple Silicon Mac and its already been over an hour since it's been stuck there (Intel-based Mac already finished running this command). The second command follows the first one and it took over 20 minutes for it to run in the Intel computer. The third command is currently running on the Intel-based computer and it's been there for over 40 minutes.
Final details
This problem is persistent in all of my Flutter projects, it doesn't matter if the project has the Firebase packages or not. I don't know what I could have changed in my Xcode configuration for things to stop working so abruptly, but I hope someone is able to help me out.
P.S. I already tried compiling a native Swift project and everything seems to work, this issue seems to affect the Flutter projects exclusively. Obviously if I try to run the commands listed earlier outside of the Flutter execution they take a very long time as well.
After running more tests I realized that the problem was iCloud. For some reason working on both computers at the same time made my local computers work very slowly. The problem was hard to find because the iCloud bird process didn't appear to use more resources than it usually would.
To solve this I had to kill iCloud on both computers and restart the service. I recently updated both computers to Ventura 13.0.1 so I think the problem might be somewhere along those lines.

I cant run my flutter project after updating to xcode 14... keep saying Unable to read project 'Runner.xcodeproj'

Unable to get Xcode project information:
2022-12-01 13:57:05.376 xcodebuild[71564:226197] Writing error result bundle to
/var/folders/6g/w7cqd0s54c33_20mrl4v2q640000gn/T/ResultBundle_2022-01-12_13-57-0005.xcresult
xcodebuild: error: Unable to read project 'Runner.xcodeproj'.
Reason: Project /Users/noel/Treegar/treegar-app/ios/Runner.xcodeproj cannot be opened because it is missing its
project.pbxproj file.
i keep getting this error when ever i run flutter run or flutter build ios.
i dont know what to do... it works fine on android but not on ios.
ive updated xcode and flutter same problem
flutter doctor -v
UPdate cocoapod to latest version
update flutter
update xcode
This error message indicates that the Runner.xcodeproj file is missing or cannot be opened.
This file is part of the Xcode project for your Flutter app and is necessary for building and running the app on iOS.
To fix this issue, try the following steps:
Make sure that you have the latest version of Xcode installed on
your computer. You can check for updates and download the latest
version of Xcode from the Mac App Store.
Make sure that you have the latest version of the Flutter SDK
installed on your computer. You can update Flutter by running the
flutter upgrade command in a terminal window.
Make sure that you have the latest version of CocoaPods installed on
your computer. You can update CocoaPods by running the
sudo gem
install -n /usr/local/bin cocoapods
command in a terminal window.
Make sure that you have a valid Xcode project file for your Flutter
app. If the Runner.xcodeproj file is missing, you can try running
the flutter create . command in the root directory of your Flutter
app to recreate the Xcode project files.
If the above steps do not help, you can try deleting the ios directory in your Flutter app and running the flutter create . command again to recreate the Xcode project files from scratch.
After trying these steps, try running the flutter run or flutter build ios command again to see if the issue has been resolved. If you continue to encounter errors, please provide more information about the specific steps you are taking and the full error message you are seeing.
try flutter clear and pubget.
or
try pod install
or
if it is not harmfull for your code try to delete ios folder and recreate it
in your project. may be this can work .

Not able to build for IOS after flutter upgrade to 1.20.2

I am facing the issue after upgrading to stable flutter version 1.20.2. I am not able to run on IOS. when I start debugging I get this error.
Xcode build done. 48.6s
Failed to build iOS app
Exited (sigterm)
Could not build the application for the simulator.
flutter run -v
Before that, I was on flutter 1.17.5 and everything was working. It is happening on all of my projects. How to resolve?
It happens to me also after Upgrading flutter, My project does not work.Then i create new project and copy paste previous code in new projects.This works for me because previous projects have old dependencies.Try it

Flutter, Cannot Build For iOS: Missing .h-Files

Building our Flutter project fails on iOS. The following steps work without problems:
running on the XCode simulator (flutter run)
building in the terminal (flutter build ios)
running on a real device in debug mode (flutter run -d "abcd")
If I open the project in XCode, change the build target to "Generic iOS Device" and hit "Build" or "Archive" I get the following error:
/Users/.../development/testproject/ios/Runner/GeneratedPluginRegistrant.m:6:9: 'flutter_exif_rotation/FlutterExifRotationPlugin.h' file not found
After removing the FlutterExifRotationPlugin, the error reoccurs with the next plugin alphabetically, so I figured that plugins in general don't work at the moment.
I tried:
dev, stable and master channels of flutter
reinstalling XCode
reinstalling Flutter
create a new project and moving the old files there
But nothing worked so far.
Ok the solution was very simple. I had to open the .xcworkspace file instead of the .xcodeproject one.
One WEEK went down the pipe for this error. I hope that you, future reader, will find this comment useful.

Resources