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

pavei avatar Sep 30 '16 22:09 pavei

Any update?

feda8891 avatar Oct 05 '16 16:10 feda8891

ionic resources --splash is working for me when I feed it with a 2500x2500 24-bit PNG (I tried different resolutions but they didn't work). I am using CLI 2.0.0

UPDATE Of course this size won't fit for iOS iPad Pro splashes, since they are larger (~2700px)

RaffaeleT avatar Oct 07 '16 15:10 RaffaeleT

2800*2800 32 bit 10.3 Mega worked fine with me ! :)

engehabahmed avatar Oct 10 '16 20:10 engehabahmed

2800x2800 is not working for me, it still fails to generate splash resources.

seiyria avatar Oct 15 '16 18:10 seiyria

Everyone, I would highly recommend removing any metadata that is with the image, and then ensuring it has NOT been converted to sRGB or any other different profiles are applied to the image.

cjba7 avatar Oct 26 '16 16:10 cjba7

We recently released a new version of the CLI that should resolve the resources issues. Could you please update your CLI to at least 2.1.4?

npm install -g ionic@latest

Thank you!

jthoms1 avatar Oct 28 '16 00:10 jthoms1

➜ ionic-quickstarter git:(master) ✗ ionic resources --icon Ionic icon resources generator uploading icon.png... icon.png (1024x1024) upload complete generating icon ios [email protected] (87x87)... generating icon ios [email protected] (58x58)... generating icon ios icon-small.png (29x29)... icon ios [email protected] (58x58) generated generating icon ios [email protected] (167x167)... icon ios icon-small.png (29x29) generated generating icon ios [email protected] (152x152)... icon ios [email protected] (87x87) generated generating icon ios icon-76.png (76x76)... icon ios [email protected] (152x152) generated generating icon ios [email protected] (144x144)... icon ios icon-76.png (76x76) generated generating icon ios icon-72.png (72x72)... icon ios [email protected] (167x167) generated generating icon ios [email protected] (180x180)... icon ios icon-72.png (72x72) generated generating icon ios [email protected] (120x120)... icon ios [email protected] (180x180) generated generating icon ios icon-60.png (60x60)... icon ios [email protected] (120x120) generated generating icon ios [email protected] (100x100)... icon ios icon-60.png (60x60) generated generating icon ios icon-50.png (50x50)... icon ios [email protected] (100x100) generated icon ios [email protected] (120x120) generated generating icon ios [email protected] (80x80)... icon ios [email protected] (80x80) generated generating icon ios icon-40.png (40x40)... icon ios icon-50.png (50x50) generated generating icon ios [email protected] (114x114)... icon ios icon-40.png (40x40) generated generating icon ios icon.png (57x57)... icon ios icon.png (57x57) generated

。。。 。。。。

wait for long time nothing gen

xujingbao avatar Nov 06 '16 03:11 xujingbao

I'm having the same problem on Mac OS X El Capitan, even with the ionic@latest update. If I look through the resources/android/icon directory, I can see the icon and splash files have been generated, but I still only get the default icon. I've tried deleting the android-debug.apk file and rebuilding, and though I can see the files in the res directory under the platform/android directory, these changes are not being reflected in the app.

I generated the layout using Ionic Creator, if that makes any difference.

iammeat avatar Nov 07 '16 19:11 iammeat

@jthoms1 why close this bug before validating it's working for everyone?

avoidwork avatar Nov 08 '16 11:11 avoidwork

Not working yet

masumonline avatar Nov 09 '16 11:11 masumonline

not working on 2.1.4

punksta avatar Nov 10 '16 13:11 punksta

use ionic cli 2.0.0

xujingbao avatar Nov 10 '16 14:11 xujingbao

I'm using 2.1.7 and as @iammeat mentioned, its not working for android. However I can see the images are generated in the resources/android folder and I can see references in the config file too.

screen shot 2016-11-11 at 9 59 58 am

and this works fine with ios

I'm using

icon - 1025 × 1025 (icon.png) splash - 2209 × 2209 (splash.png)

sameera207 avatar Nov 10 '16 23:11 sameera207

Same problem than @sameera207 the resources are generated, but don't work for android...

victorcarvalhosp avatar Nov 12 '16 14:11 victorcarvalhosp

I am experiencing the same issue, resources are generated but I cannot see them on android.

For the icon to work I did this:

ionic platform rm android
ionic platform add https://github.com/apache/cordova-android.git#master

but still the splash is not showing

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.6.0
Xcode version: Not installed

geocine avatar Nov 12 '16 14:11 geocine

There is a cordova plugin for icon and another for splash. They do work fine.

Em 12/11/2016 11:30, "Aivan Monceller" [email protected] escreveu:

I am experiencing the same issue, resources are generated but I cannot see them on android.

For the icon to work I did this:

ionic platform rm android ionic platform add https://github.com/apache/cordova-android.git#master

but still the splash is not showing

— 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-260125175, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5WWJt0swDH3UhY49yX4GJeyjGGvMWjks5q9c2egaJpZM4JJs4m .

evandrojr avatar Nov 12 '16 18:11 evandrojr

For anyone experiencing the same issue - Splash screen not showing even though the resources are present. You need to know that to be able to show your splash screen you need to un-satisfy this condition

if (drawableId == 0 || (splashscreenTime <= 0 && hideAfterDelay)) {
    return;
}

So in this case you need to put this on your config.xml

<preference name="SplashScreenDelay" value="3000"/>

Set a SplashScreenDelay , do not leave it on 0 (This will disable your splashscreen). You can set the SplashScreenDelay to a long time then hide the splash in ionic.

  initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      Splashscreen.hide();
    });
  }

You need to import this:

import { Splashscreen } from 'ionic-native';

geocine avatar Nov 12 '16 18:11 geocine

ionic platform rm android ionic platform add https://github.com/apache/cordova-android.git#master ionic resources --icon ionic resources --splash

.. this fixed my woes...

hiddenkirby avatar Nov 14 '16 04:11 hiddenkirby

Unbelievable working solution here! More than 2 hours from my life. How long are you trying to solve this?

I'm on mac, ionic info below.

First, I had similar problems as sameera207 5 days ago: after

ionic resources

the generation happened, and I had the proper(...? uhm...) changes in config.xml

I also noticed as somebody above, that there is also res folder (I dont know what is creating it and when, and why...)

Now, I managed to work with icons, but I have no idea why it is working.

I followed the top anwser from here: [http://stackoverflow.com/questions/23830467/generating-ios-and-android-icons-in-cordova-phonegap] which drives you there: [https://github.com/AlexDisler/cordova-icon] This is a command line tool, and after I followed the steps it successfully created the sized icons, BUT(!) I dont know where! The output is pretty neat and it is telling you, its done. BUT after that, I had the icons in res and also in resources!!! But after an android build it really works, and after apk install, I have the icon correctly on my phone.

The amazing thing is: if I delete/rename the resources folder, it stops working! I mean, if i retry with cordova-icon, the generation still works, but after that, android build fails: it cant find resources folder; which has my OLD (random?) files, not the just created with cordova-icon. But after rename it to resources the app has the icons from cordova-icon.

I've just done it twice, so I feel it can't be totally random. Please add any comment, I'm really really confused.

+1 note: caching is disabled for be in /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/resources.js, but i dont know if it is needed.

ionic info gives me:

Your system information:

Cordova CLI: 6.4.0 Ionic CLI Version: 2.0.0 Ionic App Lib Version: 2.0.0 ios-deploy version: Not installed ios-sim version: Not installed OS: Mac OS X El Capitan Node Version: v6.9.1 Xcode version: Xcode 8.1 Build version 8B62


Dependency warning - for the CLI to run correctly, it is highly recommended to install/upgrade the following:

Install ios-sim to deploy iOS applications.npm install -g ios-sim (may require sudo) Install ios-deploy to deploy iOS applications to devices. npm install -g ios-deploy (may require sudo)


PEZO19 avatar Nov 15 '16 15:11 PEZO19