Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Flavors: Can't find Generated.xcconfig

Tags:

xcode

ios

flutter

I am currently trying to set up Flutter Flavors in iOS.

Sadly, I get the error, that Generated.xcconfig is not found. I tried everything I could find on the internet.

From flutter clean, to Xcode clean, to flutter build... Nothing really worked.

The File is in the Flutter folder of iOS, I double checked that. I also have the Generated.xcconfig file in that folder.

The error doesn't apply to the already generated Debug and Release.xcconfig.

 /Users/username/IdeaProjects/project_new/ios/example_project.xcconfig:1: could not find included file
'Generated.xcconfig' in search paths (in target 'Runner' from project 'Runner')

Thank you so much!

like image 310
coala003 Avatar asked Dec 10 '22 00:12

coala003


2 Answers

If the file 'Generated.xcconfig' really exists you may want to check if your MyConfig.xcconfig is in the right directory which is "/ios/Flutter/". Xcode may show you in the left panel that it is in that directory but in reality the path maybe different - you need to check the file property.

like image 86
N'joy Y'ventr Avatar answered Dec 25 '22 07:12

N'joy Y'ventr


For anyone looking for the solution to this issue and looking for more details than the previous answers, here's what worked for me.

First, I encountered the same exact issue as the OP, stating that the Generated.xcconfig could not be found. If you look closely at the error message posted, you will see that Xcode is trying to find the Generated.xcconfig file in the /ios folder, and not the /ios/Flutter folder where it should be (and where the other .xcconfig files are located). See the bolded text below.

/Users/username/IdeaProjects/project_new/ios/example_project.xcconfig:

To confirm this is the issue, open the project in Finder and navigate to your ios folder. You should see your custom .xcconfig file here, and the default .xcconfig files in the ios/Flutter folder.

To remedy this, open up Xcode and start the process of creating a configuration file again. The steps to do this are:

  1. Right click on the Flutter folder in the project directory
  2. Click New File... and create a Configuration Settings File
  3. This step is key, and is most likely why your current .xcconfig file is not working as expected. Make sure to double click on the Flutter folder inside of the ios folder, ensuring that your file is created inside this folder and NOT in the root of the ios folder
  4. Make sure to check off Targets: Runner
  5. Create the .xcconfig file, add it to your configuration/scheme, and try building again
like image 35
saif Avatar answered Dec 25 '22 09:12

saif