flutterxcodemacosapple-m1apple-silicon

Error: 'FlutterMacOS/FlutterMacOS.h' file not found


  1. Create a new Flutter project with flutter create demo
  2. Build & run the new project for macOS desktop -- builds OK
  3. Add package_info_plus and use it in the app to show the version number
  4. Repeat step 2 -- fails!
  5. Create a public repository with this demo project with a GitHub actions runner trying to reproduce the failure I'm seeing locally -- builds OK

So, something is going wrong in my local environment.

Chip Memory macOS XCode
Apple M1 Pro 16 GB 14.7.1 (23H222) Xcode 16.1 Build version 16B40
Launching lib/main.dart on macOS in debug mode...
Running pod install...
Building macOS application...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-001851E921D2801E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00006000-001851E921D2801E, name:My Mac }
/Users/charney/demo/macos/Pods/Target Support Files/package_info_plus/package_info_plus-umbrella.h:13:9: error: double-quoted include "FPPPackageInfoPlusPlugin.h" in framework header, expected angle-bracketed instead
/Users/charney/.pub-cache/hosted/pub.dev/package_info_plus-8.1.0/macos/package_info_plus/Sources/package_info_plus/include/package_info_plus/FPPPackageInfoPlusPlugin.h:5:9: error: 'FlutterMacOS/FlutterMacOS.h' file not found
/Users/charney/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c++_arm64-apple-macos10.14_gnu++20/Test/Test.framework/Headers/Test.h:1:9: error: (fatal) could not build module 'package_info_plus'
/Users/charney/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c++_arm64-apple-macos10.14_gnu++20/Test/Test.mm:1:9: error: (fatal) could not build module 'Test'
/Users/charney/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c_arm64-apple-macos10.14_gnu17/Test/Test.framework/Headers/Test.h:1:9: error: (fatal) could not build module 'package_info_plus'
/Users/charney/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c_arm64-apple-macos10.14_gnu17/Test/Test.m:1:9: error: (fatal) could not build module 'Test'
** BUILD FAILED **

Error: Build process failed

I have also posted this issue to https://github.com/fluttercommunity/plus_plugins/issues/3341

I have tried to no avail


Solution

  • try this solution

    1. flutter clean

    2. rm -rf ./pubspec.lock

    3. go to directory IOS

    4. rm -rf ./Podfile.lock

    5. arch -x86_64 pod repo update

    6. flutter pub get

    7. arch -x86_64 pod install

    hope this gonna help