AngeloAvv / flutter_flavorizr

A flutter utility to easily create flavors in your flutter application
https://pub.dev/packages/flutter_flavorizr
MIT License
468 stars 85 forks source link

Often breaks when added to an existing project with /Flutter.h file not found #192

Closed mobikats closed 1 year ago

mobikats commented 1 year ago

Hi, I like this package and am using it more frequently, but have noticed that every time I add it to an existing project, I get this iOS breakage when archiving:

Failed to build iOS app
Error (Xcode): 'Flutter/Flutter.h' file not found
.../GeneratedPluginRegistrant.h:9:8

I can run the app from Xcode, but not Archive, and I cannot run from Flutter (VSCode)

The only solutions appear to be to delete the ios folder and regenerate it. See for example: https://stackoverflow.com/questions/71094048/error-xcode-flutter-flutter-h-file-not-found https://www.zuli.life/it-en/3975.html

However, often my projects have complicated Xcode configurations, including multiple extensions and custom config, and regenerating like that is actually very painful.

Given that this error looks like it will be solved with a trivial config change somewhere (eg, a path is broken?), I am wondering if a kind soul stumbling upon this might know the answer?

haphu4247 commented 1 year ago

Hi Guy, i also met the problem like this, when adding extension for ios.

i fixed here: https://github.com/AngeloAvv/flutter_flavorizr/issues/197

mobikats commented 1 year ago

Thanks @haphu4247 , that looks much better to whatever I ended up doing, I will come back here next time this happens :)

mobikats commented 1 year ago

After upgrading to Xcode 15 and implementing the fixes here: https://medium.com/@tkarmakar27112000/xcode-15-issue-related-to-flutter-3-fix-8f681c725126

I am now stuck with:

Failed to build iOS app
Error (Xcode): 'Flutter/Flutter.h' file not found
.../app/ios/Runner/GeneratedPluginRegistrant.h:9:8

Very frustrating, I am spending more time on rubbish like this every time something updates, than I am building features :(

mobikats commented 1 year ago

This does not work:

rm podfile.lock pod deintegrate pod install --repo-update

Nor all the steps here: https://stackoverflow.com/questions/76012528/xcode-14-3-failed-to-emit-precompiled-header-runner-runner-bridging-header-h

AngeloAvv commented 1 year ago

This does not work:

rm podfile.lock pod deintegrate pod install --repo-update

Nor all the steps here: https://stackoverflow.com/questions/76012528/xcode-14-3-failed-to-emit-precompiled-header-runner-runner-bridging-header-h

I believe 99% of the time these problems come from Xcode/Cocoapods/Libraries and have nothing to do with flutter_flavorizr as I face them every day as a mobile engineer, even though I'm not using flutter_flavorizr as a third-party dependency.

There's 50% chance you're using an old version of Cocoapods which was causing troubles with the latest version of XCode, or maybe you have third-party dependencies no longer updated with an old iOS SDK, or you messed around with pods/locks files.

Can you share the Cocoapods version and a list of third-party dependencies you're using in your pubspec.yaml, please?

mobikats commented 1 year ago

Yes you are absolutely right, sorry I didn't mean to blame this package I just wrote here at the time because it was where I last wrote about it, but I have added an SO question too.

I upgraded Cocoapods to 1.13.0 but it hasn't helped. Right now I am working through my (large) list of packages and upgrading them too.

Here's my list, I've removed versions on those that I am currently upgrading:

logger: email_validator: intl: crypto: http: step_progress_indicator: flutter_secure_storage: internet_connection_checker: url_launcher: cached_network_image: local_auth: expandable: geolocator: geocoding: add_2_calendar: carousel_slider: flutter_switch: qr_flutter: ^4.0.0 exponea: ^1.4.1 flutter_google_places_hoc081098: html_unescape: package_info_plus: ^1.4.3+1 hooks_riverpod: syncfusion_flutter_sliders: syncfusion_flutter_core: dartz: equatable: flutter_native_splash: ^2.2.9 youtube_player_flutter: ^8.1.2 flutter_animated_dialog: ^2.0.1 sliver_tools: share_plus: ^6.0.1 uni_links: ensure_visible_when_focused: map_launcher: focus_detector: shared_preferences: animations: get: flutter_animation_progress_bar: horizontal_blocked_scroll_physics: confetti: video_player: oktoast: path_provider: dio: permission_handler: device_info_plus: image_gallery_saver: flutter_sequence_animation: upgrader: flutter_staggered_grid_view: ^0.4.1 tween_image_widget: flutter_cache_manager: flutter_otp_text_field: stack_trace: flutter_flurry_sdk:

Thanks for any help, very much appreciated - I seem to hit this a couple of times a year and it always takes hours to resolve and is always a different solution needed each time! :/

mobikats commented 1 year ago

Strangely just step 2 from this link seemed to solve it in the end, sorry for adding noise here but maybe it becomes useful to someone https://franktheprogrammer.com/blog/flutter/troubleshooting-xcode-15-build-issues-flutter