Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter ios Build failing: Unsupported Swift Architecture, but only in Flutter Flavor

I have a flutter app for which flutter run always works perfectly, for pretty much any simulator we have.

I now have to setup flutter flavors as it is a requirement that multiple different versions of the app have to be present on the same device (production app being used by employees + test app with new features for internal alpha testing on employee phones). For both Android and iOS.

For Android, the setup of flutter flavors works perfectly according to the docs.

But, when following this guide here and also properly updating the Podfile as mentioned in the guider, running pod install again, and then flutter run --flavor flavorname, I'm getting the error:

User-Defined Issue (Xcode): Unsupported Swift architecture

and the application fails to build.

I've been digging and trying to fix this for hours now, but I'm clueless now. Deintegrating and re-loading the pods, deleting the derived data, cleaning the build folder, removing and regenerating the Podfile.lock; none of that works. I've interestingly found others with this problem too, e.g. here. But without answers. For me, the error happens with the package shared_preferences (2.2.2), but again only when trying to run the app via --flavor. Through normal flutter run everything works. But as the shared_preferences package is maintained by the official flutter.dev publisher, I guess it's me who's missing something??

like image 973
DevelJoe Avatar asked Oct 29 '25 02:10

DevelJoe


1 Answers

updating the Podfile helped me with this issue:

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["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"

        end
  end
end

source: https://github.com/juliansteenbakker/mobile_scanner/issues/1018#issuecomment-2268413760

like image 67
sergey.tyan Avatar answered Oct 30 '25 16:10

sergey.tyan