Cordova ios error building Images.xcassets

30,719

Solution 1

I would recommend using the cordova-icon and cordova-splash npm packages. This is because you can just put two images in your root, then the commands will work out the rest for you. They are written by cordova, and you can install using:

npm install -g cordova-icon
npm install -g cordova-splash

Then just put a 1024x1024 version of your logo as "icon.png" in the project root. And:

"The splash screen image should be 2208x2208 px with a center square of about 1200x1200 px. The image may be cropped around the center square."

https://www.npmjs.com/package/cordova-splash

Just put an image matching that description in the project root as "splash.png"

Remove any lines in config.xml that specify the images to use for ios, cordova-icon/splash will automatically put them in the correct place with the right names so that xcode will recognize them.

Once you've got that setup, just execute these commands:

cordova platform remove ios
cordova platform add ios
cordova-icon
cordova-splash

Then run your build command. For me it is:

cordova build ios --build-config

But you may not have a build config, or need additional params. If the build fails (make sure you run the command even if you think it will fail - it will set things up) just open the generated workspace in platforms/ios in xcode, clean the project, and build. That should work.

Solution 2

I managed to fix this issue by:

  • removing any icon or splash screen references in the config.xml file;
  • put a splash.png and/or icon.png files in the www/resources folder of your cordova project; then,
  • run the ionic cordova resources --icon or ionic cordova resources --splash command

this will create all the correct splash/icon files for you and add them to the config.xml file. That warning then goes away.

Hope this works!

Solution 3

  1. Rename Platform/ios
  2. on terminal type: cordova platform add ios
  3. cordova build ios.

worked at my case

Solution 4

For a solo icon.png file, the image must be 1024x1024 to get working with a solo <icon src="icon.png"/> in the config.xml.

I have to this with cordova-cli 6.5.0, cordova-ios 4.5.1 and xcodebuild 9.0.

Solution 5

I got this error when I was using cordova-icon but my icon.png image was not square.

Changing the icon.png to a square image and re-doing cordova-icon meant that cordova build ios now works for me.

Share:
30,719
csga5000
Author by

csga5000

I work for Guru Technologies writing iOS, web, and android apps.. as well as anything else our clients ask for. After working in the field for users for a company that contracts with various businesses I've worked with so many technologies it's not worth listing and I'll probably be outdated next week. At time of writing, my favorite language for an API is Ruby (with grape, sinatra, or rails), for a frontend web I like to use angular, and for mobile I prefer flutter. I'm excited about the coming of language interoperability, new technologies based on web assembly, increased use of AI in software, self driving car tech, and fuchsia.

Updated on May 14, 2020

Comments

  • csga5000
    csga5000 almost 4 years

    I've spent a lot of time trying to work this out to no avail.

    I udpated cordova and since el capitan my mac now has issues with NPM and cordova.

    I got it to install but I have to use sudo for cordova now.

    I tried the following:

    sudo cordova platform remove ios
    sudo cordova platform add ios
    sudo cordova build ios
    

    And this gives me the following output:

    ** BUILD FAILED **
    
    
    The following build commands failed:
        CompileAssetCatalog build/emulator/<AppName>.app <AppName>/Images.xcassets
    (1 failure)
    ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/cordova/build-debug.xcconfig,-project,<AppName>.xcodeproj,ARCHS=i386,-target,<AppName>,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/sharedpch
    You may not have the required environment or OS to build this project
    Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/cordova/build-debug.xcconfig,-project,<AppName>.xcodeproj,ARCHS=i386,-target,<AppName>,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/sharedpch
    

    Cordova version

    sudo cordova -v
    6.0.0
    

    Update: I'm now running 6.1.1, still the same issue

    Cordova iOS platform version

    sudo cordova platform ios -v
    6.1.1
    

    Mac Version: 10.11.3
    XCode Version:7.2.1