Ionic-cli: Resources is not working for platform specific icon

Created on 7 Nov 2017  ·  13Comments  ·  Source: ionic-team/ionic-cli

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:

Most helpful comment

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.

All 13 comments

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 now I am asking why I not tried that, thanks dude, it solved the problem closing the issue.

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

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

@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 😁

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

any update?

@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.

@dwieeb here is the image that I used.

@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)?

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.

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.

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.

Was this page helpful?
0 / 5 - 0 ratings