Icon cannot be found on build

Bug #1455905 reported by David Planella
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Cordova Ubuntu
Fix Released
Medium
Maxim Ermilov

Bug Description

On Ubuntu 14.10, with a simple cordova app, the build fails because the icon cannot be found. The icon does exist, but I at least could not figure a way to specify it.

$ apt-cache policy cordova-cli
cordova-cli:
  Instaŀlat: 4.1.0~ubuntu14.10.1-ubuntu2
  Candidat: 4.1.0~ubuntu14.10.1-ubuntu2
  Taula de versió:
 *** 4.1.0~ubuntu14.10.1-ubuntu2 0
        500 http://ppa.launchpad.net/cordova-ubuntu/ppa/ubuntu/ utopic/main amd64 Packages
        100 /var/lib/dpkg/status

Steps to reproduce:

$ cordova create test-app com.ubuntu.developer.myid.test-app "Test App"
$ cd test-app
$ cordova platform add ubuntu
$ vi config.xml

<icon src="img/logo.png" />

$ cordova build --device
missing icon element in config.xml
missing icon element in config.xml
Running command: /tmp/test-app/platforms/ubuntu/cordova/build --device
Building Phone Application...
Missing icon
Error: /tmp/test-app/platforms/ubuntu/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/share/cordova-cli/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

Now if I edit the config.xml file again, specifying a path not relative to the www dir:

<icon src="www/img/logo.png" />

$ cordova build --device
Error: icon does not exist: /tmp/test-app/platforms/ubuntu/www/www/img/logo.png
    at Object.module.exports.update_manifest (/usr/share/cordova-cli/node_modules/cordova-lib/src/cordova/metadata/ubuntu_parser.js:98:33)
    at Object.module.exports.update_from_config (/usr/share/cordova-cli/node_modules/cordova-lib/src/cordova/metadata/ubuntu_parser.js:59:21)
    at Object.module.exports.update_project (/usr/share/cordova-cli/node_modules/cordova-lib/src/cordova/metadata/ubuntu_parser.js:147:21)
    at /usr/share/cordova-cli/node_modules/cordova-lib/src/cordova/prepare.js:122:27
    at Array.map (native)
    at /usr/share/cordova-cli/node_modules/cordova-lib/src/cordova/prepare.js:65:40
    at _fulfilled (/usr/share/cordova-cli/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/share/cordova-cli/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/share/cordova-cli/node_modules/q/q.js:749:13)
    at /usr/share/cordova-cli/node_modules/q/q.js:509:49

Revision history for this message
Maxim Ermilov (zaspire) wrote :

put icon in booth location.

Changed in cordova-ubuntu:
assignee: nobody → Maxim Ermilov (zaspire)
importance: Undecided → Medium
Revision history for this message
David Barth (dbarth) wrote :

This has been fixed for a while : https://github.com/Zaspire/cordova-ubuntu/commit/5adb376c9b00170358e29f2026af28cb2302c203

Can you confirm the cordova-cli version you used during those tests ?

David Planella (dpm)
description: updated
Revision history for this message
Daniel Beck (d-danielbeck) wrote :

The problems still exists in the latest version (from today - 2015-05-18). The patch from comment #2 didn't fix the problem:

Manifest.js assumes the icons path is /tmp/project/${icon_from_config_xml}.
It should however be /tmp/project/www/${icon_from_config_xml}.

I created a pull request correcting the behavior: https://github.com/Zaspire/cordova-ubuntu/pull/9/files

David Planella (dpm)
tags: added: cordova-blocker cordova-workshop
Revision history for this message
Maxim Ermilov (zaspire) wrote :

new version uploaded to cordova-ubuntu ppa

Changed in cordova-ubuntu:
status: New → Fix Released
Revision history for this message
Daniel Beck (d-danielbeck) wrote :

Several ways exist to package an application and reference the icons.

The config.xml file can be in the top-level directory "app/config.xml" (this is the "new" way of packaging an application) or in app/www/config.xml (The "old way, before cordova version 3.3.1, see http://cordova.apache.org/docs/en/4.0.0/config_ref_index.md.html#The%20config.xml%20File). Both ways of packaging an app are supported by cordova 5.0.

Starting from that, I identified at least three ways of resolving icons within an app:

1) The "new" way of packaging an app resolves the icon relative to the root of the app: (see link http://cordova.apache.org/docs/en/4.0.0/config_ref_images.md.html).

2) Icons can also be resolved relative to the www/res/icons directory. See link: http://cordova.apache.org/docs/en/3.3.0/config_ref_images.md.html#configuring-icons-in-the-cli

3) Finally, it looks like that when the config.xml file is saved under app/www/, the icons can also be located relative to the app/www directory.

Summarizing: Icons can be located relatively to
 - the root-dir app/ [1]
 - the dir app/www/res/icons [2]
 - the dir app/www [3]

Green Mahjong combines the ways [2] and [3]: https://github.com/danbeck/green-mahjong/blob/master/GreenMahjong/www/config.xml

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.