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:
github.com/flutter/flutter/issues/99387#issuecomment-1105467295
2
Answers
I think you should follow this way:
flutter pub get
cd ios
arch -x86_64 pod install
That issue can be because of Pods conflicts. If the reason is that, the way which I wrote above must work.
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 target