Cannot run flutter app in iOS simulator: warning: [CP] Unable to find matching .xcframework slice in ... [Flutter]

Viewed 3114

I am getting this error when I run my flutter project in iOS simulator:

warning: [CP] Unable to find matching .xcframework slice in myProject/ios/Pods/FirebaseFirestore/FirebaseFirestore/abseil.xcframework abseil framework ios-i386_x86_64-simulator ios-x86_64-maccatalyst ios-armv7_arm64' for the current build architectures (arm64 x86_64 i386).

In android emulator and iOS device it's working fine.

2 Answers

Worked for me:

rm ios/Podfile

Then upgrade your packages:

flutter pub upgrade

And update your podfile:

cd ios && pod update

Then clean and run:

flutter clean && flutter run

In order to fix that issue I was needed to set "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" to Yes for the library. You can do that manually but changes will be lost once you re-run pod install.

In order to set that automatically you can make necessary changes in your ios/Podfile, here's code example:

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["ONLY_ACTIVE_ARCH"] = "YES"
    end

  end
end

This was inspired by another answer, you can find more info if you need by following that link https://stackoverflow.com/a/64139830/1078641

Related