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

Macos run problem. With problem resolution #217

Open SergeShkurko opened 11 months ago

SergeShkurko commented 11 months ago

I found resolution for fix macos build

Same this: Error (Xcode): Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-development-input-files.xcfilelist'

Thoughts:

macos catch error when build because xcode really cannot find the generated pods file but file exist... hm...

Task Xcode -> Targets "Runner" -> Build Phases -> [CP] Embed Pods Frameworks has two interested fields: "Input File Lists" and "Output File Lists" For example we get "input file Lists" and read it: ${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist where CONFIGURATION would be one of 'Debug', 'Profile', 'Release' then we check PODS_ROOT:

Damn! Pods root path couldn't set for flavors

Conclusion:

We need set xcode Build Setting PODS_ROOT for all configurations to ${SRCROOT}/Pods

SergeShkurko commented 11 months ago

@AngeloAvv can you create fix in package?

SergeShkurko commented 11 months ago

Simple manual way for fix macos run:

Set it value: ${SRCROOT}/Pods

Here:

image

Good luck 😉

AngeloAvv commented 11 months ago

The quickest solution is to deintegrate the Pods (by removing pod files and folders), and run flutter pub get again.

mobikats commented 11 months ago

The quickest solution is to deintegrate the Pods (by removing pod files and folders), and run flutter pub get again.

This does not work, it leaves you with the same problem.

mobikats commented 11 months ago

Simple manual way for fix macos run:

Set it value: ${SRCROOT}/Pods

Here: image

Good luck 😉

This looks like it should work, but whenever I change any build setting I get left with:

Screenshot 2023-10-26 at 11 51 55

And when I run "pod install" again, it sets back the build settings again (!).

So right now I still can't build my project.

There must be an easier way to manage flavors in Flutter projects, I seem to spend more time trying to fix path/build issues like this than I do actually editing dart code these days - any change seems to break the build, eg Xcode changes, flutter changes, CocoaPods changes, adding an extension, etc etc - the build breaks :(

AngeloAvv commented 9 months ago

@AngeloAvv can you create fix in package?

How can I? Those entries do not even exist when you run flutter_flavorizr after creating a project in the first place. These elements are automatically added by cocoapods when you add third party libraries.

That's why deintegrating the pods, cleaning the lock files, and running the pub get will clean the Xcode folder structure and fix the problem.

AngeloAvv commented 9 months ago

@mobikats 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.

mobikats commented 9 months ago

Thanks @AngeloAvv . I think what often happens is that (at least for me) I want to run flutter_flavorizr on an already well-developed project. For example, an app owner some years later wants a new application variant for an existing project and you find yourself needing to add additional flavors to a project that might have multiple extensions, 30+ libraries, and possibly bespoke native integrations, as well as existing flavors. It's running the flavorizr here that can cause these types of breakages.

AngeloAvv commented 6 months ago

Release 2.2.3 should fix the issue

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