如何修复找不到“Flutter/Flutter.h”文件

问题描述 投票:0回答:1

上周,当我最后一次处理这个问题时,它构建得很好。 在向其他应用程序添加新功能时停止了这方面的工作,周末休息我回来,两个应用程序都不再编译。一个抱怨它是套接字异常,另一个抱怨以下问题。

Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/user/.pub-cache/hosted/pub.dev/flutter_blue_plus-1.32.7/ios/Classes/FlutterBluePlusPlugin.h:7:8

Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/user/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/ios/Classes/FPPPackageInfoPlusPlugin.h:4:8

Uncategorized (Xcode): Command SwiftEmitModule failed with a nonzero exit code


Error launching application on AR18 iPhone.

我尝试了通常的东西DT_TOOLCHAIN_DIR不能用于评估LIBRARY_SEARCH_PATHS,在xcode 15中使用TOOLCHAIN_DIR代替 我什至向 GPT 寻求帮助。没有任何效果。

所以快速列出一个清单。 -完全删除可可豆荚,重新安装它们并更新存储库。

  • 删除ios文件夹以重新生成它..几次(以防万一)。
  • 清理、清理flutter和ios项目。
  • 删除了 xcode 缓存文件。
  • 更改我的 pod 文件(见下文)

仍然无法构建应用程序。

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '13.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__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['CLANG_ENABLE_MODULES'] = 'YES'
      config.build_settings['SWIFT_VERSION'] = '5.0'
    end
  end
end


-完全删除可可豆荚,重新安装它们并更新存储库。

  • 删除ios文件夹以重新生成它..几次(以防万一)。
  • 清理、清理flutter和ios项目。
  • 删除了 xcode 缓存文件。
  • 更改我的 pod 文件
ios flutter cocoapods
1个回答
0
投票

确保所有插件都是最新的并且与您当前使用的 flutter 版本兼容。

© www.soinside.com 2019 - 2024. All rights reserved.