App doesn't run on simulators or archive, devices work

247

What worked for me after many days was deleting all hidden files in the project folder besides git related ones, .idea, .packages etc.. As well as podspec.lock and the Build folder manually.

What worked for someone else with the same issue was "Removing the flutter installation folder, then fetching again from the repo"

Both options should hopefully solve your issue.

Share:
247
Yassin Sameh
Author by

Yassin Sameh

Updated on January 02, 2023

Comments

  • Yassin Sameh
    Yassin Sameh over 1 year

    App doesn't run on IOS simulators or building archive but runs on devices. It used to run fine, suddenly (can't pinpoint what is currently different that could cause this) a similar issue happened on android with the File name is too long error after multiple flutter cleans, removing all caches it worked on a real device then on the simulators again, doesn't work for IOS though.

    Error message

    /Users/yassin/Library/Developer/Xcode/DerivedData/Runner-dnjtfjbcotehrpgzrmybaaeugzpl/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app: File name too long Command CodeSign failed with a nonzero exit code
    
    Unhandled error domain NSPOSIXErrorDomain, code 63
    

    More details on the error when running from xcode for a simulator:

    Failure Reason: Unhandled error domain NSPOSIXErrorDomain, code 63 User Info: { FunctionName = IXCopyItemAtURL; IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher; SourceFileLine = 121; }
    

    One weird behaviour i've noticed is that dart analysis is taking so long to launch, and when running on a device it builds in normal time but takes so long to install (4+ minutes) On a Macbook M1, on both android and ios which is something unusual.

    Flutter doctor

    [✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale
    en-DE)
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    [✓] Xcode - develop for iOS and macOS
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 2020.3)
    [✓] VS Code (version 1.61.0)
    

    Things i have tried:

    1. Flutter clean + Flutter pub get
    2. Deleting xcodes derived data folder + Restarting laptop and xcode
    3. flutter pub cache repair
    4. Pod install, update
    5. Revoking all certificates, installing new ones
    6. Closing automatic signing, downloading profile
    7. Locking & unlocking Keychain login access.

    Flutter run --verbose error logs:

    An error was encountered processing the command
    (domain=NSPOSIXErrorDomain, code=63):
                        copyfile of
                        file:///Users/yassin/Desktop/Projects/handles/build/ios/ipho
                        nesimulator/Runner.app/ to
                        file:///Users/yassin/Library/Developer/CoreSimulator/Devices
                        /B864AB8C-79BE-4A09-9351-DDCA31E8C22F/data/Containers/Shared
                        /SystemGroup/systemgroup.com.apple.installcoordinationd/Libr
                        ary/InstallCoordination/PromiseStaging/C21EB07A-E655-4BBA-8B
                        07-5DA8B5397AE4/Runner.app failed: File name too long
                        Unhandled error domain NSPOSIXErrorDomain, code 63
    [  +15 ms] Unable to install
    
    /Users/yassin/Desktop/Projects/handles/build/ios/iphonesimulator/Runner.app on
               B864AB8C-79BE-4A09-9351-DDCA31E8C22F. This is sometimes caused by a
    malformed
               plist file:
               ProcessException: Process exited abnormally:
               An error was encountered processing the command
    (domain=NSPOSIXErrorDomain,
               code=63):
               copyfile of
    
    file:///Users/yassin/Desktop/Projects/handles/build/ios/iphonesimulator/Runner.a
               pp/ to
    
    file:///Users/yassin/Library/Developer/CoreSimulator/Devices/B864AB8C-79BE-4A09-
    
    9351-DDCA31E8C22F/data/Containers/Shared/SystemGroup/systemgroup.com.apple.insta
    
    llcoordinationd/Library/InstallCoordination/PromiseStaging/C21EB07A-E655-4BBA-8B
               07-5DA8B5397AE4/Runner.app failed: File name too long
               Unhandled error domain NSPOSIXErrorDomain, code 63
                 Command: /usr/bin/arch -arm64e xcrun simctl install
                 B864AB8C-79BE-4A09-9351-DDCA31E8C22F
    
    /Users/yassin/Desktop/Projects/handles/build/ios/iphonesimulator/Runner.app
    [   +7 ms] Error launching application on iPhone 12.
    [  +10 ms] "flutter run" took 445,079ms.
    [  +14 ms] 
               #0      throwToolExit
    (package:flutter_tools/src/base/common.dart:10:3)
               #1      RunCommand.runCommand
               (package:flutter_tools/src/commands/run.dart:669:9)
               <asynchronous suspension>
               #2      FlutterCommand.run.<anonymous closure>
               (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
               <asynchronous suspension>
               #3      AppContext.run.<anonymous closure>
               (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #4      CommandRunner.runCommand
    (package:args/command_runner.dart:209:13)
               <asynchronous suspension>
               #5      FlutterCommandRunner.runCommand.<anonymous closure>
               (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
               <asynchronous suspension>
               #6      AppContext.run.<anonymous closure>
               (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #7      FlutterCommandRunner.runCommand
               (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
               <asynchronous suspension>
               #8      run.<anonymous closure>.<anonymous closure>
               (package:flutter_tools/runner.dart:62:9)
               <asynchronous suspension>
               #9      AppContext.run.<anonymous closure>
               (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #10     main (package:flutter_tools/executable.dart:92:3)
               <asynchronous suspension>?