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

Ionic 2 : CLI "ionic resources" doesn't generate icon and splashscreen

Open brandyscarney opened this issue 10 years ago • 89 comments

From @pom421 on July 11, 2016 15:12

Short description of the problem:

When i use the CLI and the command :

$ ionic resources

this is the answer :

(node:8537) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Ionic icon and splash screen resources generator
 uploading icon.png...
 uploading splash.png...

When i inspect the generated code, well, it seems that nothing is generated :

  • config.xml is not modified
  • resources/android/icon (for example) is not updated with the new icons
  • platforms/android/res/drawable-hdpi (for example) is not updated too

Same thing for iOS for icon and splash.

Which Ionic Version? 1.x or 2.x

I use ionic 2.0.0-beta.32 on OS X 10.11.4 (El Capitan). I have generated a tutorial project with the CLI like that :

$ ionic start biblio tutorial --v2

Copied from original issue: driftyco/ionic#7269

brandyscarney avatar Jul 11 '16 19:07 brandyscarney

+1

hugomosh avatar Jul 12 '16 19:07 hugomosh

+1

kabus202 avatar Jul 13 '16 05:07 kabus202

Is there any workaround to force generation of icon and splash resources?

mnasyrov avatar Jul 13 '16 08:07 mnasyrov

U can try it with ionic1 cli

kabus202 avatar Jul 13 '16 09:07 kabus202

For me it worked doing it with individually, i.e. ionic resources --icon

Hugo Cardoza

2016-07-13 4:16 GMT-05:00 kabbi [email protected]:

U can try it with ionic1 cli

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/driftyco/ionic-cli/issues/1166#issuecomment-232301947, or mute the thread https://github.com/notifications/unsubscribe/AA21euWBNMcN39-_Zxay2WRkXTs0tEHdks5qVK0JgaJpZM4JJs4m .

hugomosh avatar Jul 13 '16 18:07 hugomosh

I found a workaround:

generate the splashscreen with ionic 1 CLI, then copy the resource folder to ionic2 project folder, and add this to config.xml

<platform name="android"> <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" /> <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" /> <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" /> <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" /> <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" /> <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" /> <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" /> <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" /> <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" /> <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" /> <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" /> <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" /> <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" /> <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" /> <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" /> <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" /> <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" /> <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" /> </platform> <platform name="ios"> <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" /> <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" /> <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" /> <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" /> <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" /> <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" /> <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" /> <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> <icon height="57" src="resources/ios/icon/icon.png" width="57" /> <icon height="114" src="resources/ios/icon/[email protected]" width="114" /> <icon height="40" src="resources/ios/icon/icon-40.png" width="40" /> <icon height="80" src="resources/ios/icon/[email protected]" width="80" /> <icon height="50" src="resources/ios/icon/icon-50.png" width="50" /> <icon height="100" src="resources/ios/icon/[email protected]" width="100" /> <icon height="60" src="resources/ios/icon/icon-60.png" width="60" /> <icon height="120" src="resources/ios/icon/[email protected]" width="120" /> <icon height="180" src="resources/ios/icon/[email protected]" width="180" /> <icon height="72" src="resources/ios/icon/icon-72.png" width="72" /> <icon height="144" src="resources/ios/icon/[email protected]" width="144" /> <icon height="76" src="resources/ios/icon/icon-76.png" width="76" /> <icon height="152" src="resources/ios/icon/[email protected]" width="152" /> <icon height="29" src="resources/ios/icon/icon-small.png" width="29" /> <icon height="58" src="resources/ios/icon/[email protected]" width="58" /> <icon height="87" src="resources/ios/icon/[email protected]" width="87" /> </platform>

kabus202 avatar Jul 14 '16 05:07 kabus202

For the --splash generating I could only use an image as big as ~2400px. Resized down from ~2900px. Not sure what the limit is on file size, but it is confusing as I had been following this tutorial which suggests a minimum 2208x2208 for the splash image.

rongg avatar Jul 18 '16 17:07 rongg

The supplied splash template is too large (2732x2732). When the size of the splash screen file is reduced to 2208x2208 it runs without a hitch.

chriseckman avatar Jul 20 '16 03:07 chriseckman

+1

gigocabrera avatar Jul 24 '16 14:07 gigocabrera

I have my template at 2208 X 2208 with an image size of 1200 X 360. It finally generated an image but it is way too large and goes off the edge of the my Android device's screen.

bmwertman avatar Jul 25 '16 03:07 bmwertman

I have the same problem, I tried with ionic client v1 and v2 beta. If the image is too big it doesn't complete the resources task for neither icon or splash. Reducing to 2200px as suggested by some users worked, also selecting only icon generation worked.

Actually the images are uploaded to the server and generated also using a 2732px image, and you can find the resulting images in your temp folder (with a different name) but they are not copied to the resources folder.

Also consider modifying the code that generates the images to use a local imagemagick instance if available and fallback to the server if there is none, I don't understand the need to upload 2mb images and to download ~10mb if it could be done locally.

ntrp avatar Jul 26 '16 08:07 ntrp

+1 for using a local imagemagick if it is available.

mnasyrov avatar Jul 26 '16 08:07 mnasyrov

Followed what @chriseckman said, and it worked (had the issue only on iOS with nothing being generated).... The given PSD in the documentation is too large... Doesn't make sens, at least it would be good to update the documentation about that.

schankam avatar Jul 29 '16 01:07 schankam

I've just given ionic resources another try and i've been happy to notice this issue is fixed with the v2.0.0-beta35. Files are generated in resources/android and resources ios.

pom421 avatar Aug 04 '16 09:08 pom421

it started working again one week ago and now getting same issue , not working for me uploading icon.png... uploading splash.png...

i'm on v2.0.0-beta35

jtushar53 avatar Aug 04 '16 14:08 jtushar53

screenshot 2016-08-06 08 38 22

@brandyscarney Is that possible to generate icons for Apple Watch as well? with the resouces command, Xcode is giving us warnings. Please see the attached screen grab.

MrBokeh avatar Aug 06 '16 00:08 MrBokeh

screenshot 2016-08-06 14 16 47 screenshot 2016-08-06 14 16 52

@brandyscarney There are also missing splash screen sizes too for Xcode, is that possible to update the resource generator for both watch icons and missing splash screen sizes please?

MrBokeh avatar Aug 06 '16 06:08 MrBokeh

Did the following to get it to work:

  • Uninstall Ionic 2 CLI
  • Install Ionic 1 CLI (1.7.0)
  • Run ionic resources --icon and ionic resources -splash individually

ihadeed avatar Aug 15 '16 19:08 ihadeed

For Mac/Unix, try running the resources command as superuser. I tested 1 file with and without sudo and it only worked for the latter. I don't know if this is the issue because there was no "read/write permission" error when it didn't work.

rongg avatar Aug 15 '16 21:08 rongg

hi, after some logging in resources.js(ionic-app-lib) from line 463 to 491, the issue was related to firewall page displaying in response after uploading resource.

response code was 200 btw. anyway used other internet to make it work

jtushar53 avatar Aug 16 '16 10:08 jtushar53