Search code examples
iosswiftflutterxcodexcode15

Flutter Xcode 15 BIG Problem - 'Flutter/Flutter.h' file not found & SDK does not contain 'libarclite' at the path


Everything started with the message 'You can not upload your app with Current Xcode' while validating and distributing the app from Xcode.

https://developer.apple.com/news/upcoming-requirements/?id=04292024a

The unfortunate part is that I tried on the 29th; if I had tried a day earlier, I wouldn't have had to deal with this...

I updated Xcode to 15 (which also required updating my MacOS to Sonoma - we made two changes at the same time, as you can understand), and I've tried every solution imaginable for the past 3 days. I can't remember ever struggling this much with a problem before. I've tried over 20 solutions, and consistently, I'm getting errors like:

'SDK does not contain 'libarclite' at the path'

or

Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found(LAST ERROR)

Podfile:(Final, I changed it more than 10 times, always encountered with a problem)

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "11.0"
    end
  end
end

How can I solve my problem?

pubspec.yaml

name: example
description: example.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.5.3+18 

environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter

  badges: ^2.0.1
  cached_network_image: ^3.0.0
  cloud_firestore: ^2.3.0
  cupertino_icons: ^1.0.3
  dots_indicator: ^2.0.0
  easy_localization: ^3.0.0
  firebase_auth: ^2.0.0
  firebase_core: ^1.3.0
  firebase_messaging: ^10.0.3
  firebase_storage: ^9.0.0
  flutter_web_browser: ^0.14.0
  flutter_html: any
  #flutter_html: ^2.1.0
  flutter_widget_from_html: ^0.8.5
  #flutter_widget_from_html: ^0.6.1
  google_fonts: ^2.1.0
  google_sign_in: ^5.0.4
  html: ^0.15.0
  html_unescape: ^2.0.0
  image_picker: ^0.8.1+3
  intl: ^0.17.0
  introduction_screen: ^2.1.0
  launch_review: ^3.0.1
  line_icons: ^2.0.1
  lottie: ^1.1.0
  package_info: ^2.0.2
  path_provider: ^2.0.2
  provider: ^6.0.0
  #provider: ^5.0.0
  share: ^2.0.4
  shared_preferences: ^2.0.6
  skeleton_text: ^3.0.0
  fluttertoast: ^8.0.7
  url_launcher: ^6.0.9
  youtube_player_flutter: ^8.0.0
  youtube_plyr_iframe: ^2.0.7
  rounded_loading_button: ^2.0.5
  firebase_analytics: ^8.1.2
  flutter_facebook_auth: ^3.5.0
  the_apple_sign_in: ^1.1.1
  video_player: ^2.1.10
  #flick_video_player: ^0.3.1
  flutter_icons:
    git:
      url: https://github.com/adarsh-technocrat/flutter-icons
  md2_tab_indicator:
    git:
      url: https://github.com/westdabestdb/md2_tab_indicator
      
  purchases_flutter: ^4.10.3


dependency_overrides:
  flutter_math_fork: ^0.6.0
  


dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_launcher_icons: "^0.9.0"

flutter_icons:
  android: "launcher_icon"
  ios: true
  remove_alpha_ios: true #added later.
  image_path: "assets/images/icon.png"



# The following section is specific to Flutter.
flutter:

  uses-material-design: true

  assets:
    - assets/images/
    - assets/animation_files/
    - assets/translations/

  fonts:

    - family: Poppins
      fonts:
        - asset: assets/fonts/Poppins-Light.ttf
          weight: 400
        - asset: assets/fonts/Poppins-Regular.ttf
          weight: 500
        - asset: assets/fonts/Poppins-Medium.ttf
          weight: 600
        - asset: assets/fonts/Poppins-SemiBold.ttf
          weight: 700
        - asset: assets/fonts/Poppins-Bold.ttf
          weight: 800

    - family: Open Sans
      fonts:
        - asset: assets/fonts/OpenSans-Light.ttf
          weight: 400
        - asset: assets/fonts/OpenSans-Regular.ttf
          weight: 500

    - family: Manrope
      fonts:
        # - asset: assets/fonts/Manrope-Light.ttf
        #   weight: 300
        - asset: assets/fonts/Manrope-Regular.ttf
          weight: 400
        - asset: assets/fonts/Manrope-SemiBold.ttf
          weight: 500
        - asset: assets/fonts/Manrope-Medium.ttf
          weight: 600
        - asset: assets/fonts/Manrope-Bold.ttf
          weight: 700
        - asset: assets/fonts/Manrope-ExtraBold.ttf
          weight: 900

It seems like developing iOS apps with Flutter using Xcode 15 might become a thing of the past.

Flutter 3.3.4
Dart 2.18.2

Solution

  • I solved my problem finally... What did I do?

    After upgrading to Xcode15, I thought that the problem may be related with my Flutter & Cocoapods versions.

    • I upgraded my Flutter version to latest version.
    • I upgraded my Cocoapods version to latest version. Firstly uninstalled then installed... Use sudo for uninstalling & installing...
    • I made platform :ios, '13.0' in Podfile. Thanks to @Paulw11. and last lines:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
      end
    end
    
    • I upgraded all dependencies flutter pub upgrade --major-versions and corrected my source code with their new usage if required.
    • I corrected some parts of my source code (flutter version related) because some library usages was changed in the last flutter version. https://api.flutter.dev
    • I encountered dozens of problems and solved all of them diligently. It took 1-2 days. SO answers helped me too much.

    (Minimum deployments is still 12.0, I have no idea but it can be run without a problem)

    Don't forget adding GoogleService-Info.plist again from Xcode with "Add Files to Runner" in Xcode if you have before.(for Firebase projects)

    Finally, my project can be run in real iPhones & Simulator.

    My computer: M1, 2020 MBP.

    Thanks to SO platform.