flutter_flavorizr icon indicating copy to clipboard operation
flutter_flavorizr copied to clipboard

Build failed after adding widget extension to project targets

Open umbrellait-nikolay-silantyev opened this issue 2 years ago • 23 comments

Hello!

I've the following error after adding widget extension to project targets in Xcode:

image

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.

logs.txt

Finds the same issue https://github.com/flutter/flutter/issues/103977

Hello @umbrellait-nikolay-silantyev what is your minimum supported iOS version?

AngeloAvv avatar Oct 29 '22 10:10 AngeloAvv

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.

AngeloAvv avatar Oct 29 '22 21:10 AngeloAvv

Unfortunately it didn't help(

Same issue after adding Share Extension :(

ohsory1324 avatar Nov 07 '22 07:11 ohsory1324

Adding Network Extension cases the same result. Any ideas on the issue?

AndreySosnovyy avatar Nov 07 '22 07:11 AndreySosnovyy

First of all, thank you for your great work, @AngeloAvv Unfortunately I also have the issue when adding extensions.

timur-khismatullin avatar Nov 09 '22 20:11 timur-khismatullin

I can build my app after clearing "Objective-C Bridging Header" from Build Settings of target extension.

스크린샷 2022-11-11 오후 10 28 35

ohsory1324 avatar Nov 11 '22 13:11 ohsory1324

It didn't help me, there were even more errors.

image

Same issue here after adding notification extension. Any solution?

ConstantinN1 avatar Nov 17 '22 10:11 ConstantinN1

@AngeloAvv Still waiting solution for this issue

Can someone please add an easy way to reproduce it? (minimum list of step to reproduce it)

AngeloAvv avatar Jan 19 '23 08:01 AngeloAvv

I've created a sample project reproduced described errors.

Steps to reproduce:

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

AngeloAvv avatar Jan 19 '23 09:01 AngeloAvv

Sure. After creating a new flutter project:

  1. Add config to pubspec.yaml
  2. Run flutter pub run flutter_flavorizr
  3. Go to Xcode and add widget extension in project targets
  4. Choose created build scheme (you can also check it in Android Studio)
  5. It may seem that everything is ok, build success. But after running flutter clean && flutter pub get command next builds fail

@ConstantinN1 image it helps for me with ImageNotification

ARDcode avatar Jan 31 '23 01:01 ARDcode

I can build my app after clearing "Objective-C Bridging Header" from Build Settings of target extension.

스크린샷 2022-11-11 오후 10 28 35
  • Not sure, but it solved my problem. Thank you.
  • If anyone has a better solution, please exchange. Thanks!

duypxd avatar Mar 06 '23 15:03 duypxd

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 avatar Jun 02 '23 21:06 AngeloAvv

@AngeloAvv Any updates on this?

  1. create a sample project
  2. add flavor as dev
  3. add share extension as described here
  4. flutter run --flavor dev -t lib/main_dev.dart

and you should be able to get the issue this way...

bismarabia avatar Jul 25 '23 12:07 bismarabia

Same issue after adding Share Extension :(

Any solution you got?

Rishab-ms avatar Nov 09 '23 14:11 Rishab-ms

@bismarabia any updates?

Rishab-ms avatar Nov 09 '23 14:11 Rishab-ms

This comment on the official flutter repository is the solution: https://github.com/flutter/flutter/issues/103977#issuecomment-1140113798

eugeniobaglieri avatar Dec 04 '23 16:12 eugeniobaglieri