Flutter Flavors: Can't find Generated.xcconfig

Viewed 6357

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!

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

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

I ran into this error after updating to xcode 12 from 11.

the following steps solved for me:

run "Product > Clean Build Folder" on xcode 12.

run flutter clean on terminal

run flutter pub get on terminal (this will create /project/ios/flutter/Generated.xcconfig)

run pod install on terminal (assuming you are in /project/ios folder)

then you can build on xcode.

For me this happens too. BUT: it only happens if I'm using the Flutter beta channel. On Flutter stable everything works as expected. Would be really glad to have a solution, unfortunately I haven't.

After executing flutter clean, you can generate related dependencies through the flutter run command.

You can try this :

  • Xcode > Product > Clean
  • Quit Xcode

Open terminal

  • cd Library/Developer/Xcode
  • open DerivedData
  • and select all item then delete
  • restart your pc

After restart :

  • open terminal
  • flutter pub get
  • cd ios
  • pod update
  • flutter run

For me i misspelled the scheme name like "Trial", it should be "trial".

Related