ishahak
ishahak

Reputation: 6795

cordova-icon plugin is broken under Android platform 7.0.0

Installing the latest android platform 7.0.0, and then running this command:

cordova-icon

gives the following error when trying to run:

Parsing <app-folder>/platforms/android/res/xml/config.xml failed
Error: ENOENT: no such file or directory

Is there any way for fixing it?

Upvotes: 0

Views: 486

Answers (2)

Diego
Diego

Reputation: 11

I've change also the file:

/usr/local/lib/node_modules/cordova-icon/index.js

To support the mipmap icons:

platforms.push({
name : 'android',
isAdded : fs.existsSync('platforms/android'),
iconsPath : 'platforms/android/app/src/main/res/',
icons : [
{ name : 'mipmap-hdpi/ic_launcher.png', size : 72 },
{ name : 'mipmap-ldpi/ic_launcher.png', size : 36 },
{ name : 'mipmap-mdpi/ic_launcher.png', size : 48 },
{ name : 'mipmap-xhdpi/ic_launcher.png', size : 96 },
{ name : 'mipmap-xxhdpi/ic_launcher.png', size : 144 },
{ name : 'mipmap-xxxhdpi/ic_launcher.png', size : 192 },
{ name : 'mipmap-hdpi-v26/ic_launcher_foreground.png', size : 72 },
{ name : 'mipmap-ldpi-v26/ic_launcher_foreground.png', size : 36 },
{ name : 'mipmap-mdpi-v26/ic_launcher_foreground.png', size : 48 },
{ name : 'mipmap-xhdpi-v26/ic_launcher_foreground.png', size : 216 },
{ name : 'mipmap-xxhdpi-v26/ic_launcher_foreground.png', size : 324 },
{ name : 'mipmap-xxxhdpi-v26/ic_launcher_foreground.png', size : 432 },
]
});

Upvotes: 0

ishahak
ishahak

Reputation: 6795

It seems that under Android 7.0.0, the structure of the folders got some refactoring, and now cordova-icon is not compatible with it.

This should be fixed by the plugin owner, but as an immediate solution I have found that declaring some symbolic links (under Mac OSX) could solve this issue.

EDIT: Solution replaced!!

Originally I posted a solution which solved the compilation error using symbolic links, but the result was that only default icon was used instead of my custom icon.

The real solution is described here: https://github.com/AlexDisler/cordova-icon/issues/99


To fix cordova-icon:

Edit ''index.js'' of the plugin. I'm using Brackets:

open /usr/local/lib/node_modules/cordova-icon/index.js -a Brackets

replace this line:

iconsPath : 'platforms/android/res/',

with:

iconsPath : 'platforms/android/app/src/main/res/',

also remove all icon lines starting with ''drawable'' as in

{ name : 'drawable/icon.png',       size : 96 },

because icons in Android now use only mipmap versions.


To fix cordova-splash:

Edit ''index.js'' of the plugin. I'm using Brackets:

open /usr/local/lib/node_modules/cordova-splash/index.js -a Brackets

replace this line:

splashPath : 'platforms/android/res/',

with:

splashPath : 'platforms/android/app/src/main/res/',

Upvotes: 2

Related Questions