user28832237
user28832237

Reputation: 1

Flutter App Build Fails on M2 MacBook Air with Rosetta Error: "Attachment of code signature supplement failed"

I am encountering an issue when building ipa file of my Flutter App on my M2 chip MacBook Air. The app build successfully on my Mac Studio, but always fail on the laptop with the error:

error: rosetta error: Attachment of code signature supplement failed: 1
/var/db/oah/696e0658733369639e73a08cf7f6dc139beb7664301bce347578c8abc0ea947d/5736a6a6d3f8f7c6d96e251fef39431e4470b986151c860a80189c719e1eaf9d/gen_snapshot_arm64.aot
Dart snapshot generator failed with exit code -6
Target aot_assembly_release failed: Exception: AOT snapshotter exited with code -6

Command I use to build ipa

flutter build ipa

I tried the following suggested answers from the other posts.

Clean rebuild

flutter clean
rm -rf ios/Pods
rm -rf ios/.symlinks
rm -rf ios/Flutter/Flutter.framework
rm -rf ios/Flutter/Flutter.podspec
flutter pub get
cd ios
pod install
flutter build ipa

Re-install rosetta

softwareupdate --install-rosetta

Flutter doctor -v

[✓] Flutter (Channel stable, 3.24.4, on macOS 14.5 23F79 darwin-arm64, locale
    en-HK)
    • Flutter version 3.24.4 on channel stable at
      /Users/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (8 weeks ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.dev/to/macos-android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/macos-android-setup for detailed
      instructions).

[✓] VS Code (version 1.95.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   •
      macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         •
      macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript •
      Google Chrome 131.0.6778.140
    ! Error: Browsing on the local area network for x's iPhone 15. Ensure
      the device is unlocked and attached with a cable or associated with the
      same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code
      -27)
    ! Error: Browsing on the local area network for x’s iPad. Ensure the
      device is unlocked and attached with a cable or associated with the same
      local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code
      -27)

[✓] Network resources
    • All expected network resources are available.

Flutter Create a new project

copy-and-paste old code files to new folder
flutter pub get
cd ios
pod install

But none of them seem working. I have the exact same error when I tried to archive using XCode toolbar "Product->Archive". If anyone has any insight to how to resolve this rosetta error it would be very much appreciated.

Upvotes: 0

Views: 84

Answers (1)

user28832237
user28832237

Reputation: 1

Solution

I upgraded the OS two weeks ago (Sequoia 15.0 to 15.1), but it still failed to build the IPA file. I initially thought that upgrading the OS wouldn't help.

Today, I checked for updates to both the OS and Xcode. There was an available update (OS 15.2 and Xcode 16.2). After upgrading the OS and Xcode, and then rebooting, the error message disappeared.

Advice

Always ensure that your OS and Xcode are up to date.

Upvotes: 0

Related Questions