when I upgrade flutter version to 3.3.8(stable latest version) from 2.10.5
VSCode Run and Xcode can't build both.
(error output can see Flutter Run at the bottom in detail)
Xcode version: Version 14.0 (14A309)
Flutter version: 3.3.8
already try
flutter clean -> flutter pub get
delete Podfile.lock -> pod install
like this fatal error: 'Flutter/Flutter.h' file not found in flutter
flutter run
Changing current working directory to: /Users/kenny/app
Launching lib/main.dart on reddyme in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: S39CYH6PXC
Running Xcode build...
Xcode build done. 11.5s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/rz/8zvwcwsx6rnd3tfkb95xwxt00000gn/T/flutter_tools.8QZmWl/flutter_ios_build_temp_dir8OaL8z/temporary_xcresult_bundle
/Users/kenny/.pub-cache/hosted/pub.dartlang.org/wakelock-0.6.2/ios/Classes/messages.m:4:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Building targets in dependency order
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/ffmpegkit.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/libavcodec.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/libavdevice.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/libavfilter.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/libavformat.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/libavutil.framework'
note: Removed stale file
'/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/libswresample.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/ffmpeg-kit-ios-https/libswscale.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/video_thumbnail/video_thumbnail.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/sqflite/sqflite.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/url_launcher_ios/url_launcher_ios.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/wakelock/wakelock.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/share_plus/share_plus.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/path_provider_ios/path_provider_ios.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/package_info_plus/package_info_plus.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/network_info_plus/network_info_plus.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/nanopb/nanopb.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/libwebp/libwebp.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/permission_handler_apple/permission_handler_apple.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/in_app_purchase_storekit/in_app_purchase_storekit.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/image_picker_ios/image_picker_ios.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/image_editor/image_editor.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/flutter_sound/flutter_sound.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/flutter_sound_core/flutter_sound_core.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/flutter_inappwebview/flutter_inappwebview.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/geolocator_apple/geolocator_apple.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/flutter_local_notifications/flutter_local_notifications.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/firebase_messaging/firebase_messaging.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/firebase_core/firebase_core.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/ffmpeg_kit_flutter/ffmpeg_kit_flutter.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/firebase_analytics/firebase_analytics.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/connectivity_plus/connectivity_plus.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/better_player/better_player.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/Runner.app'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/audio_session/audio_session.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/Pods_Runner.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/ReachabilitySwift/Reachability.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/PromisesObjC/FBLPromises.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/PINOperation/PINOperation.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/PINCache/PINCache.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/HLSCachingReverseProxyServer/HLSCachingReverseProxyServer.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/NotificationService.appex'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/GoogleUtilities/GoogleUtilities.framework'
note: Removed stale file
'/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/NotificationService.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/NotificationService.swiftmodule/arm64-apple-ios.abi.json'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/NotificationService.swiftmodule/arm64-apple-ios.swiftdoc'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/GoogleDataTransport/GoogleDataTransport.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/NotificationService.swiftmodule/arm64-apple-ios.swiftmodule'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/OrderedSet/OrderedSet.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/FirebaseMessaging/FirebaseMessaging.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/FirebaseInstallations/FirebaseInstallations.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/FirebaseCoreInternal/FirebaseCoreInternal.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/FirebaseCoreDiagnostics/FirebaseCoreDiagnostics.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/FirebaseCore/FirebaseCore.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/GCDWebServer/GCDWebServer.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/FMDB/FMDB.framework'
note: Removed stale file '/Users/kenny/Library/Developer/Xcode/DerivedData/Runner-hjbexhbpnpltiiedgscjhkkpzqfv/Build/Products/Debug-iphoneos/Cache/Cache.framework'
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure
it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/rz/8zvwcwsx6rnd3tfkb95xwxt00000gn/T/flutter_tools.8QZmWl/flutter_ios_build_temp_dir8OaL8z/temporary_xcresult_bundle
Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/kenny/.pub-cache/hosted/pub.dartlang.org/wakelock-0.6.2/ios/Classes/messages.m:3:8
Error launching application on reddyme.
flutter run --verbose
[ +13 ms] Could not build the precompiled application for the device.
[ +5 ms] Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/kenny/.pub-cache/hosted/pub.dartlang.org/wakelock-0.6.2/ios/Classes/WakelockPlugin.h:0:8
[ +1 ms] Error launching application on reddyme.
[ +6 ms] "flutter run" took 38,881ms.
[ +4 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:713:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
flutter analyze
Analyzing ios...
No issues found! (ran in 1.2s)
flutter doctor
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.6 21G115 darwin-x64, locale zh-Hant-TW)
• Flutter version 3.3.8 on channel stable at /Users/kenny/Desktop/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (30 小時前), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/kenny/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
• Xcode at /Users/kenny/Downloads/Xcode.app/Contents/Developer
• Build 14A309
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] VS Code (version 1.73.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• reddyme (mobile) • 00008110-00065DE62639801E • ios • iOS 16.0 20A362
• macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.87
[✓] HTTP Host Availability
• All required HTTP hosts are available
Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '12.1'
# 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|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',
## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
# 'PERMISSION_LOCATION=1',
## dart: PermissionGroup.notification
# 'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1'
]
end
end
end
success build Xcode and run in Mobile
I'm doing hybrid development, adding
Flutter
to an existing iOS project. It works fine in 3.0.3, but it doesn't work after upgrading to 3.3.8. I found the answer by comparing the differences between the two versions.Version 3.0.3 is found in
.ios/Flutter/podhelper.rb
, andFlutter.xcframework
is copied fromflutter/bin/cache/artifacts/engine/ios-release's Flutter.xcframework
to.ios/ Flutter/engine
.The 3.3.8 version needs to execute the method in
flutter/packages/flutter_tools/bin/podhelper.rb
to linkFlutter.xcframework
. You can see this code in theflutter_additional_ios_build_settings
methodThen the answer is very clear, just add the flutter dependency to
xxx.podspec
of the error reporting component.