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

Hi!

I was able to get "ionic resources --icon" to work on the latest Ionic CLI version 2.1.8 and Ionic Framework Version: 2.0.0-rc.2.

However, still could not see the updated icon on the Emulator or the Device -- until after I figured out why.

My solution was to replace the icon.png files in the platforms/android/res/mipmap-* folder with the new images. I used makeappicon.com to generate icon files (which I then renamed to icon.png).

Seems like this is an issue in either Ionic or Cordova. I will file a new issue as relevant.

xke avatar Nov 15 '16 22:11 xke

Filed issue at https://github.com/driftyco/ionic-cli/issues/1683

xke avatar Nov 15 '16 22:11 xke

I am Using Cordova CLI: 6.4.0 Ionic CLI Version: 2.1.8 Ionic App Lib Version: 2.1.4 OS: Linux 4.4 Node Version: v4.2.6 not working ionic icon and splash screen. When i build my app and open show only cordova icon. How to i replace Cordova icon to new app icon ?

periyasamy17 avatar Nov 17 '16 10:11 periyasamy17

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

Fixed my issues too, i don't understand why ionic add platform android doesn't support icon and splashcreen now... I'm using: Cordova CLI: 6.4.0 Ionic CLI Version: 1.3.1 Ionic App Lib Version: 2.1.4 OS: Windows 10 Node Version: v6.9.1

Lestt avatar Nov 18 '16 13:11 Lestt

@PEZO19 got the answer to your /res generated folder here > https://github.com/driftyco/ionic/issues/9270

Hope they will fix this bug soon.

danielsawan avatar Nov 22 '16 12:11 danielsawan

Finally I got it simple working with this small script in hooks/after_build:

#!/usr/bin/env node

'use strict';

var ncp = require('ncp');

ncp('./res', './platforms/android/res', function(e){
	if(e) {
		return console.log('res copy error', e);
	} else {
		return console.log('res copied');
	}
});



You have to install ncp with: npm install ncp also

pcrombach avatar Nov 26 '16 14:11 pcrombach

Only works for me on Android when I replace the default icon.png and screen.png in the platforms/android/res folder with my own files (ionic resources command worked for file generating, splash.png was 2208x2208px, icon.png was 1024x1024px). Also had to create xxhdpi and xxxhdpi folders.

Would be great to see that bug fixed :)

Cordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.3 Ionic CLI Version: 2.1.13 Ionic App Lib Version: 2.1.7 Ionic App Scripts Version: 0.0.45 ios-deploy version: 1.9.0 ios-sim version: 5.0.8 OS: macOS Sierra Node Version: v6.7.0 Xcode version: Xcode 8.1 Build version 8B62

joergjung avatar Nov 27 '16 23:11 joergjung

+1

omateuscastro avatar Nov 30 '16 17:11 omateuscastro

See latest at https://github.com/driftyco/ionic-cli/issues/1683

xke avatar Nov 30 '16 17:11 xke

Dont use that. Use the cordova plugin that does the same way bettter

Em 30/11/2016 14:12, "xke" [email protected] escreveu:

See latest at #1683 https://github.com/driftyco/ionic-cli/issues/1683

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

evandrojr avatar Dec 02 '16 16:12 evandrojr

same issue for me too

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

saves the day

comfortme avatar Dec 04 '16 19:12 comfortme

@evandrojr hi, I would like to know which cordova pluin you use to generate icon and splash? I have problem "Unable to generate images due to an error Invalid upload: image too large: 39002607"

jimiatworking avatar Dec 14 '16 07:12 jimiatworking

If you are with IONIC2.1.13 like me, Put a splash size at 2732 x 2732 and the icon size at 192 x192. update your android plateform with cordova platform update [email protected] and execute the ionic resources . I suddgest you to copie all the res folder generated from the plateform/android and save it somewhere if in the future you face the same problem. In my case i had to come back with the command cordova platform update [email protected] before to be able to build my project again and i'm now working with no issue.

stchoukeu avatar Dec 15 '16 15:12 stchoukeu

Hi, time ago I posted a small function for a hook in your app. That function copies all the resources to the right folders.

Op 15 dec. 2016, om 16:43 heeft TCHOUKEU Simplice Aimé [email protected] het volgende geschreven:

If you are with IONIC2.1.13 like me, Put a splash size at 2732 x 2732 and the icon size at 192 x192. update your android plateform with cordova platform update [email protected] and execute the ionic resources . I suddgest you to copie all the res folder generated from the plateform/android and save it somewhere if in the future you face the same problem. In my case i had to come back with the command cordova platform update [email protected] before to be able to build my project again and i'm now working with no issue.

pcrombach avatar Dec 15 '16 17:12 pcrombach

Hi Jimi try https://github.com/AlexDisler/cordova-icon

Works well

Em 14/12/2016 04:58, "jimiatworking" [email protected] escreveu:

@evandrojr https://github.com/evandrojr hi, I would like to know which cordova pluin you use to generate icon and splash? I have problem "Unable to generate images due to an error Invalid upload: image too large: 39002607"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/driftyco/ionic-cli/issues/1166#issuecomment-266967741, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5WWOESH5gI7JOR9J3IlT8e-dn0C6HVks5rH6GngaJpZM4JJs4m .

evandrojr avatar Dec 18 '16 21:12 evandrojr

Any news on this? Was able to get icon/splash working using Lestt post from 11/8 but still only working for Android not iOS... Any word on a full solution?

wwwguy avatar Dec 30 '16 23:12 wwwguy

+1 icon and splash not copied to /platforms/android/res getting crazy of it!

balicekt avatar Jan 07 '17 18:01 balicekt

I got it to work, I just had to remove the old icons before generating.

Its probably a file exists/copy error. Does anyone know in the code where this function is invoked? If so I will happily create a pull request fixing it.

moaxaca avatar Jan 12 '17 01:01 moaxaca

@evandrojr Nice, thanks. I'll give it a try.

jimiatworking avatar Jan 12 '17 02:01 jimiatworking

Just tried it and it worked (used a new RC5 project). Execute the following commands:

$ cordova platform update [email protected]
$ ionic resources android
Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.5
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0 
ios-sim version: 5.0.11 
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.2.1 Build version 8C1002

0x1ad2 avatar Jan 18 '17 20:01 0x1ad2