Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command CompileAssetCatalog failed with a nonzero exit code

Running Xcode 10 and can not seem to find much information on this error that occurs when building my project.

Any ideas on how to fix this?

Here is the last line before the error:

Desktop/CheerApp!/CheerApp!/Assets.xcassets Command CompileAssetCatalog failed with a nonzero exit code –

Expanded:

CompileAssetCatalog /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Products/Debug-iphonesimulator/CheerApp!.app /Users/michaelansell/Desktop/CheerApp!/CheerApp!/Assets.xcassets (in target: CheerApp!) cd /Users/michaelansell/Desktop/CheerApp! /Applications/Xcode.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Intermediates.noindex/CheerApp!.build/Debug-iphonesimulator/CheerApp!.build/assetcatalog_dependencies --output-partial-info-plist /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Intermediates.noindex/CheerApp!.build/Debug-iphonesimulator/CheerApp!.build/assetcatalog_generated_info.plist --app-icon AppIcon --compress-pngs --enable-on-demand-resources YES --optimization space --filter-for-device-model iPhone11,2 --filter-for-device-os-version 12.0 --sticker-pack-identifier-prefix Mike.CheerApp-.sticker-pack. --target-device iphone --target-device ipad --minimum-deployment-target 11.4 --platform iphonesimulator --product-type com.apple.product-type.application --compile /Users/michaelansell/Library/Developer/Xcode/DerivedData/CheerApp!-ehbjnqaldsycfegiviymewkplqhm/Build/Products/Debug-iphonesimulator/

like image 713
Michael Ansell Avatar asked Sep 25 '18 01:09

Michael Ansell


4 Answers

I managed to resolve this by doing a "build clean", removing "DerivedData" folder and re-starting my Mac.

like image 193
Jmf Avatar answered Nov 14 '22 17:11

Jmf


It seems that this occurs if you change one of the images opened from the Assets. Here are some solutions that worked:

  1. Run the app on a different simulator
  2. Clean (both CMD+SHIFT+K and CMD+ALT+SHIFT+K)
  3. Re-add the Assets into the project
  4. Restart Mac
  5. JOKE: Restart the electric power plant
like image 14
User123335511231 Avatar answered Nov 14 '22 17:11

User123335511231


Make sure that you have an AppIcon file in your assets. I had the same error because I did deleted that file.

enter image description here

like image 9
Vladimir Kuzomenskyi Avatar answered Nov 14 '22 17:11

Vladimir Kuzomenskyi


If you have or have had multiple versions of Xcode open, you may need to reboot the CoreSimulatorService, an evil background service that somehow remains online and available to many versions of Xcode despite it being compatible with only one version, and clean up the associated files.

In my case, there seems to be a compatibility issue between Xcode 13.2.1, 13.4.1 and 14-beta. After hours of searching, the following commands finally pulled me out of a pit of reboots, reinstalls, and deleting DerivedData.

# Make sure the correct version of Xcode is selected
xcode-select -p

# Clear out conflicting devices here, if any
rm -rf ~/Library/Developer/CoreSimulator/Devices

# Trigger the Simulator service to restart
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService

# Clean up Xcode simulator references
xcrun simctl delete unavailable

If this alone doesn't work, there could also be an issue where CoreSimulatorService was installed by a conflicting version of Xcode and even restarting will not remedy your situation. You can see that this daemon is run from a global directory on your system, which is initialized by Xcode in the install scripts on first launch:

$ ps aux | grep CoreSimulator
user    13668   0.0  0.0 408883856  17760   ??  S     9:52AM   0:00.05 /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/SimulatorTrampoline.xpc/Contents/MacOS/SimulatorTrampoline
user    13665   0.0  0.0 408765760  25248   ??  S     9:52AM   0:03.20 /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService
root              2161   0.0  0.0 408612544  10432   ??  Ss    9:29AM   0:06.33 /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Resources/bin/simdiskimaged
user     2158   0.0  0.0 408574240   7088   ??  S     9:29AM   0:00.07 /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/SimLaunchHost.arm64.xpc/Contents/MacOS/SimLaunchHost.arm64

This is a little more involved, because it requires that the /Library/Developer/ directory be cleaned out before Xcode restarted to replace the broken version.

rm -rf /Library/Developer/**

Note that your Terminal.app or whatever you are using for your shell will need full disk access in order to do this, under System Preferences > Security & Privacy > Full Disk Access > [Terminal.app]

The reinstall should launch after starting the desired version of Xcode, but you can also manually run the install pkg files inside to re-execute this install process /Application/<Xcode.app>/Contents/Resources/Packages/.

Other symptoms of this issue: Simulators not showing up in the Window > Devices and Simulators listing and simctl throwing errors and being unable to find base iOS SDKs similar to the following:

$ xcrun simctl list
...
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-15-5 --
    iPhone 8 (55A90310-8202-4A0D-968B-00F440D42210) (Shutdown) (unavailable, runtime profile not found)

See also:

  • Encountered an error communicating with IBAgent-iOS. Failed to boot device iPhone Xs
  • Xcode device Unavailable, runtime profile not found
like image 9
markshiz Avatar answered Nov 14 '22 16:11

markshiz