flutter_flavorizr
flutter_flavorizr copied to clipboard
Build failed after adding widget extension to project targets
Hello!
I've the following error after adding widget extension to project targets in Xcode:
Could not build the precompiled application for the device.
Error (Xcode): 'Flutter/Flutter.h' file not found
/Users/Documents/project/ios/Runner/GeneratedPluginRegistrant.h:9:8
Error (Xcode): failed to emit precompiled header '/Users/silantyevnikolay/Library/Developer/Xcode/DerivedData/Runner-anzfeujngjowppasdsounxstfsnn/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_340HJIQUP00U2-clang_2H0A2ME3M3335.pch'
for bridging header
'/Users/Documents/project/ios/Runner/Runner-Bridging-Header.h'
It's work well if I choosing Runner scheme, but build failed when using schemes created by plugin.
The launch logs are attached below.
Finds the same issue https://github.com/flutter/flutter/issues/103977
Hello @umbrellait-nikolay-silantyev what is your minimum supported iOS version?
Runner target specifies 11.0 iOS minimum deployment version, widget extension - 14.0.
If you set the minimum deployment version to 12.0 you will probably solve the problem.
Unfortunately it didn't help(
Same issue after adding Share Extension :(
Adding Network Extension cases the same result. Any ideas on the issue?
First of all, thank you for your great work, @AngeloAvv Unfortunately I also have the issue when adding extensions.
I can build my app after clearing "Objective-C Bridging Header" from Build Settings of target extension.

It didn't help me, there were even more errors.
Same issue here after adding notification extension. Any solution?
@AngeloAvv Still waiting solution for this issue
Can someone please add an easy way to reproduce it? (minimum list of step to reproduce it)
I've created a sample project reproduced described errors.
Steps to reproduce:
- Clone repository and run project in Xcode with dev scheme
Hey @umbrellait-nikolay-silantyev , thanks for your help.
I wanted to reproduce the issue from scratch in order to understand what's going on.
Can you describe the steps in some sort of an ordered list?
Sure. After creating a new flutter project:
- Add config to pubspec.yaml
- Run flutter pub run flutter_flavorizr
- Go to Xcode and add widget extension in project targets
- Choose created build scheme (you can also check it in Android Studio)
- It may seem that everything is ok, build success. But after running flutter clean && flutter pub get command next builds fail
@ConstantinN1
it helps for me with ImageNotification
I can build my app after clearing "Objective-C Bridging Header" from Build Settings of target extension.
![]()
- Not sure, but it solved my problem. Thank you.
- If anyone has a better solution, please exchange. Thanks!
Ok I reproduced the issue but I can't understand what's going on there. I never worked with extensions before so any help to understand why everything breaks would be appreciated.
As far as I understand, sounds like adding an extension in XCode causes the project to have a new scheme, which leads to an ambiguous situation.
By running one of my flavors I'm getting the following error which is totally different from the errors you all reported here:
angeloavv@iMac-Pro-di-Angelo example % fvm flutter run --flavor staging -t lib/main_staging.dart
Launching lib/main_staging.dart on iPhone 13 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 1,3s
Failed to build iOS app
Error (Xcode): Multiple commands produce '/Users/angeloavv/Library/Developer/Xcode/DerivedData/Runner-ddgjpwxuawdfdighpjmyluxewnnv/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/Objects-normal/x86_64/ConfigurationIntent.o'
@AngeloAvv Any updates on this?
- create a sample project
- add flavor as dev
- add share extension as described here
- flutter run --flavor dev -t lib/main_dev.dart
and you should be able to get the issue this way...
Same issue after adding Share Extension :(
Any solution you got?
@bismarabia any updates?
This comment on the official flutter repository is the solution: https://github.com/flutter/flutter/issues/103977#issuecomment-1140113798