ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Resources is not working for platform specific icon

Open leonardosalles opened this issue 9 years ago • 13 comments

Description:

When I try to generate platform specific icon with a PNG inside resources/android/icon and another PNG inside resources/ios/icon it simple ignores and throw an error, but if I use the same image at resources/icon.png it works. So I think the problem is with platform specific icons.

Steps to Reproduce:

Put an image inside resources/android/icon and try to generate their resources. It will fail, then try to put the same icon.png at resources root folder and generate resources, it will work.

Output:

√ Collecting resource configuration and source images - done!
√ Filtering out image resources that do not need regeneration - done!
√ Uploading source images to prepare for transformations - done!
√ Generating platform resources: 12 / 12 complete - done!
√ Modifying config.xml to add new image resources - done!

The following images were not created because their source image was too small:
     drawable-xxxhdpi-icon.png     android/icon needed 192x192px
     drawable-xxhdpi-icon.png     android/icon needed 144x144px
     drawable-xhdpi-icon.png     android/icon needed 96x96px
     drawable-hdpi-icon.png     android/icon needed 72x72px
     drawable-mdpi-icon.png     android/icon needed 48x48px
     drawable-ldpi-icon.png     android/icon needed 36x36px

My ionic info:

cli packages: (C:\sabemi-digital\node_modules)

    @ionic/cli-utils  : 1.16.0
    ionic (Ionic CLI) : 3.16.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.3.0 ios 4.4.0
    Ionic Framework    : ionic-angular 3.8.0

System:

    Node : v6.11.3
    npm  : 3.10.10
    OS   : Windows 8.1

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy

Other Information:

leonardosalles avatar Nov 07 '17 17:11 leonardosalles

I had this exact message. Turns out I'd accidentally stopped tracking my icon.png files in git and they weren't in the filesystem.

Put them back under resources/android/ and resources/ios/ and ran ionic cordova resources and it worked. Turns out in my case the error was a cryptic way of saying the icon.png files don't exist.

@leonardosalles you mentioned you put the file at resources/android/icon/. Try dropping back one level to resources/android/ and moving it there. That is where the source file should be. The resources/android/icon/ directory is for the generated icons. Similarly for splash and other platforms.

Nathan

nrcrabbe avatar Nov 16 '17 23:11 nrcrabbe

@nrcrabbe now I am asking why I not tried that, thanks dude, it solved the problem closing the issue.

leonardosalles avatar Nov 17 '17 13:11 leonardosalles

Odd. I may re-open this to investigate that cryptic error message, if you don't mind @leonardosalles.

imhoffd avatar Nov 17 '17 21:11 imhoffd

I get same issue irrespective of where the resource source files are kept. I think its a CLI issue

chukwu avatar Nov 18 '17 16:11 chukwu

@dwieeb Sure, it will be nice if we have a more friendly message like ""Please insert your resources inside platform root folder" or something like that 😁

leonardosalles avatar Nov 18 '17 20:11 leonardosalles

I am still getting this issue. Has there been a CLI fix?

drewg2009 avatar Dec 31 '17 19:12 drewg2009

any update?

erperejildo avatar Mar 05 '18 13:03 erperejildo

@erperejildo @drewg2009 @leonardosalles @chukwu @nrcrabbe The warning message may be accurate--please ensure your source images are large enough to generate appropriately sized resources.

For those who are getting the original issue, please provide me a source image which is causing the isse. I can't seem to reproduce the issue.

imhoffd avatar Mar 06 '18 16:03 imhoffd

@dwieeb here is the image that I used.

leonardosalles avatar Mar 06 '18 17:03 leonardosalles

@leonardosalles If I move that image to resources/android/icon/icon.png (making sure that both resources/android/icon.png and resources/icon.png don't exist), I get the following correct error:

[ERROR] Source image files were not found for the following platforms/types:

        - android/icon
        - ios/icon

        Please review --help

Are you still able to reproduce this issue? If you can reproduce the issue with latest (3.19.1), can you see if it's still an issue for the 4.x CLI (npm i -g ionic@canary)?

imhoffd avatar Mar 06 '18 20:03 imhoffd

I noticed three things, first was that running for the second time the error would still occurred but the error message would not unless I did a "ionic cordova resources -f"

Second was that I had Icon.png not icon.png after changing to lower case my issue was resolved.

Third some icons, for Apple, were missing looking at xcode.

NDMCreative avatar May 03 '18 08:05 NDMCreative

Hello guys, i fixed it. Solution is icon png must be in 24 bits, not 32bit, splash 8bits, not 23 or 32bits. Then everything works properly. Check your png's bit depth.

saruululzii avatar Dec 07 '18 09:12 saruululzii

I fixed this in ionic v4 by making sure the size is 1024x1024 pixels. When I got the error the png file had smaller dimensions.

PriceFallin avatar Jun 24 '19 03:06 PriceFallin