Ionic 2 : CLI "ionic resources" doesn't generate icon and splashscreen
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
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.
Filed issue at https://github.com/driftyco/ionic-cli/issues/1683
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 ?
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
@PEZO19 got the answer to your /res generated folder here > https://github.com/driftyco/ionic/issues/9270
Hope they will fix this bug soon.
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
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
+1
See latest at https://github.com/driftyco/ionic-cli/issues/1683
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 .
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
@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"
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.
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.
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 .
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?
+1 icon and splash not copied to /platforms/android/res getting crazy of it!
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.
@evandrojr Nice, thanks. I'll give it a try.
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