0

In my flutter application, when I try to run the app on an emulator or real device, it shows me the following message without error details (I use Mac M1):

Android Studio error is:

Running pod install...
Running Xcode build...
Xcode build done.                                           22.3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/h4/f0yhqb6d0rg8gtlft3shw5140000gn/T/flutter_tools.4Xwkjf/flutter_ios_build_temp_dir2m7ZnF/temporary_xcresult_bundle


    Failed to package /Users/leonardo/Development/flutter/git/resultadoloteria_flutter.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'AppAuth' from project 'Pods')
    /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'ReachabilitySwift' from project 'Pods')
    /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'leveldb-library' from project 'Pods')

    Result bundle written to path:
        /var/folders/h4/f0yhqb6d0rg8gtlft3shw5140000gn/T/flutter_tools.4Xwkjf/flutter_ios_build_temp_dir2m7ZnF/temporary_xcresult_bundle


Could not build the application for the simulator.
Error launching application on iPhone 8.

Xcode error is (there is no error details):

PhaseScriptExecution Run\ Script /Users/leonardo/Library/Developer/Xcode/DerivedData/Runner-arvdcpgzmyfuxqhgvygiyzfywxcj/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-9740EEB61CF901F6004384FC.sh (in target 'Runner' from project 'Runner')
    cd /Users/leonardo/Development/flutter/git/resultadoloteria_flutter/ios
    export ACTION\=build
    export AD_HOC_CODE_SIGNING_ALLOWED\=YES
    export ALLOW_TARGET_PLATFORM_SPECIALIZATION\=NO
    export ALTERNATE_GROUP\=staff
    export ALTERNATE_MODE\=u+w,go-w,a+rX
    export ALTERNATE_OWNER\=leonardo
    export ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES\=YES
    export ALWAYS_SEARCH_USER_PATHS\=NO
    export ALWAYS_USE_SEPARATE_HEADERMAPS\=NO
    export APPLE_INTERNAL_DEVELOPER_DIR\=/AppleInternal/Developer
    export APPLE_INTERNAL_DIR\=/AppleInternal
    export APPLE_INTERNAL_DOCUMENTATION_DIR\=/AppleInternal/Documentation

... A lot of export lines....

    export __CODE_SIGNING_ALLOWED_appletvos\=NO
    export __CODE_SIGNING_ALLOWED_iphoneos\=NO
    export __CODE_SIGNING_ALLOWED_watchos\=NO
    export arch\=undefined_arch
    export variant\=normal
    /bin/sh -c /Users/leonardo/Library/Developer/Xcode/DerivedData/Runner-arvdcpgzmyfuxqhgvygiyzfywxcj/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-9740EEB61CF901F6004384FC.sh


Failed to package /Users/leonardo/Development/flutter/git/resultadoloteria_flutter.
Command PhaseScriptExecution failed with a nonzero exit code

I have tried to downgrade flutter (from 3.3 to 3.0.5), reinstall xcode, revoke certificates and install again, but nothing works.

My current flutter doctor is:

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5.1 21G83 darwin-arm, locale es-419)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Update: I discover something that works but flutter team said that is not an option: enter image description here

github.com/flutter/flutter/issues/99387#issuecomment-1105467295

Fabio
  • 685
  • 6
  • 14
  • Finally I decided to restore my mac. After restore, I install xCode, Flutter, Android Studio and everything works fine. – Fabio Sep 09 '22 at 19:57
  • What did you mean by restoring your mac? Did you delete Xcode, Flutter, and Android Studio, and reinstall them? Because I did all those. Is there a specific sequence or some folders that need to be removed? I've been stuck for almost a week now. Thanks! – Zenko Oct 10 '22 at 10:27
  • By restore mac I mean erase and reinstall macOs. First I delete XCode, flutter and Android Studio and reinstall but do not work. Then I erase everything and reinstall macOs then reinstall android studio, flutter, xcode and after that works. – Fabio Oct 11 '22 at 11:19
  • Wow, that would be a lot of work, re-setting, Path variables, installing java, nvm, and all. But thank you! – Zenko Oct 12 '22 at 03:12
  • But worth trying. Thank you! – Zenko Oct 12 '22 at 03:44
  • This cannot be the only option here? To completely uninstall everything and reinstall everything? – Dennis Ashford Oct 28 '22 at 20:43
  • Yes, I spent several days trying different options but nothing worked for me. I thought maybe it was a problem with my machine and so I decided to restore it. It's unbelievable that there isn't another clearly documented solution option. – Fabio Oct 30 '22 at 21:23

2 Answers2

0

I think you should follow this way:

  1. Delete pubspec.lock ios/Podfile.lock files
  2. Delete ios/Pods folder
  3. Execute flutter pub get
  4. Enter to ios folder via terminal withcd ios
  5. Execute arch -x86_64 pod install
  6. Run application now That issue can be because of Pods conflicts. If the reason is that, the way which I wrote above must work.
Jakhongir Anasov
  • 1,207
  • 7
  • 16
0

in my case, I was able to run it in the simulator successfully, but at the time of running it on the real device of iOS I faced this issue, I solved this issue by changes in Build Active Architecture only: yes and Excluded architecture:i386 in both pod target and application targetenter image description here

enter image description here