Ary
Ary

Reputation: 462

Error building ios with cordova

I have a problem when I build the ios platform with cordova. I have all the certificates for the app and device, but when I try to run in my ios device, doing ionic run ios, the console return this error:

Error: Source path does not exist: resources/ios/icon/[email protected]

This path is written in config.xml file.

I tried to run it in xCode but the problem there was:

Cordova/CDVViewController.h not found

I read a lot of possible solutions but any works for me.

My xCode version is 7.3.1, the cordova version is 6.3.0 and the cordova ios version is 4.2.0.

Upvotes: 27

Views: 39781

Answers (18)

Tuhin Kole
Tuhin Kole

Reputation: 1

use

ionic cordova resources --icon

if permission required use sudo

sudo ionic cordova resources --icon

it will Generated 28 resources for iOS and Generated 6 resources for Android.

Upvotes: 0

crg
crg

Reputation: 4557

I used the no brain way, but it works. I added the ressources temporarily with the name they ask for.

Like I copy and past an image icon-20 copy.png then rename it into my needed ressources like [email protected]

Upvotes: 0

Jonathan
Jonathan

Reputation: 123

It's likely that your resources haven't been run.

Run:

npm i -g cordova-ionic platform rm ios
ionic platform rm ios // You want to do this just so when you recreate you have necessary resouces
ionic cordova resources
ionic cordova build --release <ios/android>

There should be more answers with this solution, since ionic is a project based on npm and this command will install the necessary libraries.

Upvotes: 0

ir2pid
ir2pid

Reputation: 6126

it's a cat and mouse problem,

  1. the icon resources aren't built because the platform isn't added and
  2. platform can't be added because the icon resource isn't there

ionic/cordova is pretty unstable and a nightmare to work with in CI pipeline.

this kept crashing out CI pipeline. just keep removing and adding the android/ios platform and build the resources using ionic cordova resources --force

Upvotes: 1

user5683572
user5683572

Reputation: 71

I ran into the same problem:

Error: Source path does not exist: resources/ios/icon/[email protected]

Looks like the relative path is in reference to the config.xml. If the resources folder exists inside of 'www', then you may need to update the relative path.

I was able to resolve this by updating the relative path to "www/resources/...".

Upvotes: 0

I got similar issue with cordova-ios@~4.5.1

ionic cordova build ios

> cordova build ios
Error: Source path does not exist: resources\android\icon\drawable-xhdpi-icon.png

[ERROR] An error occurred while running cordova build ios (exit code 1).

ionic cordova platform add ios

> cordova platform add ios --save
Using cordova-fetch for cordova-ios@~4.5.1

Adding ios project...

Creating Cordova project for the iOS platform:

Path: platforms/ios
Package: -
Name: -
iOS project created with [email protected]

Error: Source path does not exist: resources\android\icon\drawable-xhdpi-icon.png

I remove ios platform

ionic cordova platform remove ios

And add ios platform with old one

ionic cordova platform add [email protected]

This worked for me, waiting for an Cordova update :)

Upvotes: 1

Lasneyx
Lasneyx

Reputation: 2310

I've found this issue in several occasions and some of the provided answers worked quite well till today, when no one worked.

My environment: MacOS high Sierra 10.13, ionic cli 3.18.0 and cordova 7.1.0.

My problem was that if I run ionic cordova prepare it fails saying that I need to add a platform and if a I add a platform with ionic cordova platform add ios it fails with the error specified in the answer:

Error: Source path does not exist: resources/ios/icon/[email protected]

What solved my issue was manually creating the platforms folder: mkdir platforms. After creating this folder, adding a platform worked as usual.

I hope it could help someone out there.

Upvotes: 1

Devendra Gohel
Devendra Gohel

Reputation: 112

You just need to update the cordova to fix this error: to update the cordova run below command

$sudo npm install -g [email protected]

once you update the cordova type below command to remove the platform

$sudo ionic cordova platform rm ios --save

And then add platform again using below command

$sudo ionic cordova platform add ios --save

I hope this will help you.

Upvotes: 0

Krishna
Krishna

Reputation: 8486

It says that the resources directory only contained empty folders. Downloading this repo (https://github.com/ionic-team/ionic2-app-base/tree/master/resources) and replace the resources directory

Run again the "ionic cordova resources".

Upvotes: 0

Gregor Sklorz
Gregor Sklorz

Reputation: 1705

Try to replace the "\" with "/" (backslash and slash) in the config.xml.

If you create the project on a Windows system and move to macOS for iOS compilation, it still has the Windows URI format.

Upvotes: 3

Eric Gopak
Eric Gopak

Reputation: 1833

Update - 03-08-2017

> ionic cordova resources

Old CLI command:

I had the same error, and after re-running ionic resources it went away.

The problem was that I had Windows-style slashes (backslashes) in the path of the icon, i.e. the error I had was this:

Error: Source path does not exist: resources\ios\icon\icon-40.png

So, converting backslashes into slashes resolved it for me.

Update: And regarding your second error, it helped me to reset the state:

ionic state reset

Make sure you have ios listed under cordovaPlatforms in your package.json before running this command. Then ionic automatically re-downloads your plugins afresh and is ready to build.

Hope that helps. Take care!

Upvotes: 39

I had to manually copy the files from any another project repo such as https://github.com/sphilee/eTAS_GPS/tree/master/resources/ios

Upvotes: 0

vijeth.ag
vijeth.ag

Reputation: 545

Running these commands solved it for me:

ionic platform rm ios

ionic resources

ionic platform add ios

Upvotes: 0

yu canghai
yu canghai

Reputation: 99

I have try some times, finally success.

  1. use ionic resources --icon , maybe met the new problem

"Unable to generate images due to an error Failed to upload source image: Error: read ECONNRESET"

don't worry , try it later

  1. use ionic platform remove ios when execute successfully use ionic platform add ios

DON'T USEionic state reset

Upvotes: 3

Saranjith
Saranjith

Reputation: 11547

Just use: Remove platform

cordova platform remove ios

And add ios platform with old one

cordova platform add [email protected] --save

It worked for me..

@4.0.0 will select previous version automatically

Upvotes: 11

user1476793
user1476793

Reputation: 9

make sure you add: xmlns:cdv="http://cordova.apache.org/ns/1.0

to the widget section(on the very top) of your config.xml

This will add all necessary Cordova components.

Upvotes: -1

0kk0
0kk0

Reputation: 324

I've had same error only with other image:

Source path does not exist: resources/ios/icon/[email protected]

This happened after upgrading to Cordova 6.3.0 and I've solved it downgrading Cordova.

Quickfix for now:

npm uninstall -g cordova
npm install -g [email protected]

Upvotes: 20

Joseph Ocasio
Joseph Ocasio

Reputation: 999

If you are missing the icon you can run the command

ionic resources --icon

This will generate all the icons with the pixels needed to run on any device.

To simulate on the device you first need to

ionic build ios

and then

ionic simulate ios

It is also a good practice to have xcode up to date.

If you are still getting the error you can paste this line

"$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"

on Build Settings > Header Search Paths. Do not remove the similar line, just add it at the end.

Upvotes: 60

Related Questions