AngeloAvv / flutter_flavorizr

A flutter utility to easily create flavors in your flutter application
https://pub.dev/packages/flutter_flavorizr
MIT License
456 stars 81 forks source link

Error (Xcode): Unable to load contents of file list: . . . ..xcfilelist #223

Open AllyTechEngineering opened 11 months ago

AllyTechEngineering commented 11 months ago

New clean flutter project and followed the setup steps. This project will become an app that views Simpsons and The Wire characters but use one code base and just change the api data url to change the variant. Used Android Studio and VS Code and same error. My development environment: MacBook Pro with Apple M1 Pro chip and 16GB of memory. macOS is Sonoma version 14.0 Flutter: 3.13.6 and Dart: 3.1.3. Xcode 15.0.1 and CocoaPods version 1.13.0 It appears that Flavorizr is not setting up the Configuration Files in Xcode for each of the builds I setup. These files should be in Pods/Target Support files/Pods-Runner Error message: errorMessage

Error (Xcode): Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-simpsons_char_viewer-input-files.xcfilelist' Error (Xcode): Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-simpsons_char_viewer-output-files.xcfilelist' Could not build the application for the simulator. Error launching application on iPhone 14 Pro. Solution Open the project in Xcode - see attachment one.png and two.png.

one two

All of the new variations created by Flavorizr are missing the Configuration Files and that is causing the error (two.png). Add Configuration Files to each of the variations created by Flavorizr (see three.png).

three

In Xcode build the project and then exit. New .xcfilelist files are added to ios/Pods/Target Support Files/Pods-Runner In the IDE flutter clean and then pub get. In your IDE run the project variations again and it works as expected.

Source code: https://github.com/AllyTechEngineering/flavorizr_bug

Abhi011999 commented 10 months ago

this solved my issue too, thanks!

andryot commented 10 months ago

Thank you, you saved my day!

AllyTechEngineering commented 10 months ago

Glad to be of help - that was a real puzzler but thank God I found it.

AngeloAvv commented 9 months ago

This solution is wrong, even though for some reason it seems working. According to the first screenshot, looks like the setup mentioned in the README has been done in the wrong way (looks like xcodeproj was missing in the first place), and then multiple runs of the flavorization process have been done to try to fix the problem. flutter_flavorizr will create its xcfilelist according to the target and the flavor, picking the default one is wrong as you won't be able to pass extra params to the executables through these files.

AllyTechEngineering commented 9 months ago

Hi, thanks? I am still puzzled by your answer. I followed the guidance in the flavorizr example and readme and had the issue I reported. I then created the typical Flutter start project and setup as if in a clean project without multiple 'runs' and still got the same issue. I then went back to the project I was working on and applied my "Solution" was able to get back to work. I took the time and effort to try and document (in my original project with "multiple runs" ) so not sure where you are coming from. I don't have time to create a clean project, setup Flavorizr and then re-present the issue and document for you. I assume that somewhere I did not follow the "guidance" about how to use the package correctly and that is why the issue happened? If you would take the time to explain how my issue happened in as much detail as I explained what happened I could understand but your cryptic response is to say the least disappointing.

AngeloAvv commented 9 months ago

@AllyTechEngineering I added the Troubleshooting section in the README where I explain what are the right steps to get rid of the problem once and for all.

MirzaCickusic commented 9 months ago

This has been causing me issues for some time. First on iOS, I resolved this by switching to the latest Flutter version, and deleting and re-creating ios project. However, I noticed that the issue starts to happen again whenever I run flavoritz CLI command for a second time.

Then the same issue was happening with Mac Flutter app. I managed to resolve the issue by re-creating the macos directory and running the flavoritz CLI command before I try to run the app.

The documentation provided above, helped me to figure out that any additional flavoritz CLI command ran after the initial iOS or macOS project Podfile.lock file was created, will break those projects. Which is unfortunate. But important to keep in mind.

It is mentioned in the troubleshooting doc "when you run flutter pub get, it will regenerate the Pods, but it will not regenerate the xcfilelis files which are used by XCode to compile the project.". I haven't yet tried this, but it would be a major bummer to have to deal with this issue after each library version upgrade.

mobikats commented 7 months ago

@AllyTechEngineering I added the Troubleshooting section in the README where I explain what are the right steps to get rid of the problem once and for all.

The problem is that the troubleshooting steps described in your link don't always solve this :/

My experience matches that of @MirzaCickusic and others where this problem comes back and isn't straightforward to resolve (I never end up with a definite recipe for solving).

RonanOD commented 7 months ago

This did the trick for me! Thanks

ricardoboss commented 6 months ago

@AllyTechEngineering I added the Troubleshooting section in the README where I explain what are the right steps to get rid of the problem once and for all.

This did not fix it for me. Any other tips I could try?

Edit: what's curious, the files reported are there and not empty...

image
dan-tt commented 6 months ago

Update below files in your flutter project. go to ios > flutter >

ios > flutter > Debug.xcconfig

#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"

ios > flutter > Release.xcconfig

#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"

after trying all, it worked for me.

youssefali424 commented 6 months ago

@AngeloAvv So really nothing clear can you please provide a way to either disable looking for those files as an option (like not using icons specific for flavor ) because currently that really hurt when the app stopped building on ci/cd for iOs (ex codemagic) so i doubt it is an issue with cache if really i knew this would happen i wouldn't have used the package and added them manually as i used this package so that the flavors adding becomes automated but then i notice in the issues you mention that it can't be reversed nor it can be rerun again

AngeloAvv commented 6 months ago

@youssefali424 as I said multiple times, this problem has nothing to do with flutter_flavorizr, but is Cocoapods related. You would face the very same problem even if you do it manually.

What we can do instead, is trying to find a way to instruct Cocoapods about this scenario. According to the official Flutter documentation, we could customize the build configurations in our Podfile.

I'll do some research in these days to see if it might work

VittorioParagallo commented 6 months ago

same problem here... i tried all the proposed solutions to get the build done and launch the app, the only one working was the @AllyTechEngineering's one at the top of the discussion.

youssefali424 commented 6 months ago

@AngeloAvv this should be added to generation step of xcconfig files

#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"

every generated xcconfig with the related file this is the solution mentioned by @dan-tt and it did work every time on ci/cd which had clean env

AngeloAvv commented 6 months ago

@youssefali424 this doesn't work if your project doesn't have third party dependencies. The library should be as more agnostic as possible.

@AngeloAvv this should be added to generation step of xcconfig files

#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"

every generated xcconfig with the related file this is the solution mentioned by @dan-tt and it did work every time on ci/cd which had clean env

AngeloAvv commented 6 months ago

same problem here... i tried all the proposed solutions to get the build done and launch the app, the only one working was the @AllyTechEngineering's one at the top of the discussion.

Just because it works, doesn't mean it's the proper way of doing things. Every configuration should reference its own xcconfig file, not the default one generated during the Flutter project creation process.

That's why the solution proposed by @AllyTechEngineering is not totally correct.

youssefali424 commented 6 months ago

At least add as an option to yaml ? or to the troubleshoot guide @AngeloAvv I got stuck with this for some time that is why i hope it is solved so now one have to go to the same path again without doing this it is impossible to manage a project with any pod dependencies

AngeloAvv commented 6 months ago

@youssefali424 I might have found a solution to fix this problem, I'll keep in touch

AngeloAvv commented 6 months ago

Release 2.2.3 should fix the issue

AllyTechEngineering commented 5 months ago

AngelAvv: sorry for causing you any trouble. At the time I posted originally I was just trying to get a project done and wanted to share how I fixed my issue. Never said it was the right thing to do - it just worked for me on that project. Thanks for the hard work on the package!

KashifUmar123 commented 3 months ago

Thanks, this solution is working perfectly for me.

juarezfranco commented 1 month ago

For those who, after a while, need to add a new flavor and encounter this issue, my solution was, upgrade to Release 2.2.3 and:

cd ios
rm Podfile.lock
rm -r .symlinks
rm -r Pods # <--- this fix 
pod install

Good luck

903612643 commented 4 weeks ago

Don't use Xcode,use VSCode . open terminal , 'flutter devices' select devices xxx@xxxMacBook-Pro flutter_deer-master % flutter devices Found 3 connected devices: iPhone 15 Pro Max (mobile) • 3746EC00-2E55-48F9-806A-8FDC41CAC9A4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) macOS (desktop) • macos • darwin-x64 • macOS 13.5.1 22G90 darwin-x64 Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.113

xxx@xxxMacBook-Pro flutter_deer-master % flutter run Connected devices: macOS (desktop) • macos • darwin-x64 • macOS 13.5.1 22G90 darwin-x64 Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.113

No wireless devices were found.

Please choose one (or "q" to quit): 1 Launching lib/main.dart on macOS in debug mode... Running pod install... 3.7s warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner') Building macOS application...
✓ Built build/macos/Build/Products/Debug/flutter_deer.app Syncing files to device macOS... 977ms

kiranojhanp commented 6 days ago

This worked for me

cd macos
pod deintegrate
pod ios