2

I am using ionic framework version 1.7.14 to create an android app. I am trying to generate icon and splash screen by following the steps mentioned here.

I have created a directory 'resources' at the root of my project and added 2 images: icon.png (192x192) and splash.png (2208x2208) in that. Now when I run

$ ionic resources

It generates the directory 'android' in resources with subdirectories 'icon' and 'splash' in it. But, there are no images generated. All directories are empty and I get following error while building the project:

Android project created with cordova-android@5.1.1
cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-ldpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-mdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-hdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-xhdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-xxhdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/icon/drawable-xxxhdpi-icon.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-ldpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-mdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-hdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-xhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-xxhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-land-xxxhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-ldpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-mdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-hdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-xhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-xxhdpi-screen.png

cp: no such file or directory: /myprojects/testApp/resources/android/splash/drawable-port-xxxhdpi-screen.png
Nikola
  • 14,888
  • 21
  • 101
  • 165
Lokesh Sardana
  • 43
  • 2
  • 10

4 Answers4

3

As far as i know you do not have to create resources folder. It is created by default when you do: ionic start myapp [template]

ionic resources --icon (Creates Icons)

ionic resources --splash (Creates splash)

You have to replace the default icon.png and splash.png within the resources folder also make sure they are of right specified dimensions.

If these don't work try removing and adding android or ios platforms again.

Hasta Tamang
  • 2,205
  • 1
  • 18
  • 17
  • Tried removing and adding platform. It generated the resources folder by default this time. But when I replaces the default icon.png and splash.png and ran "ionic resources", it didn't do anything. The resources/android/icon and resource/android/splash folders still have the default ionic images – Lokesh Sardana Mar 13 '16 at 18:30
  • My guess is somehow your resources files are being cached. Does it happen on all your projects. Please verify this by creating an empty project and run ionic resources on that project. If it's cached you will have to delete all the resources files .png from the platform and try ionic resources. Also remember you have to run ionic build android or ionic prepare andriod – Hasta Tamang Mar 13 '16 at 19:44
  • 1 - ionic prepare android 2 - ionic prepare ios 3 - ionic resources – Hasta Tamang Mar 13 '16 at 19:45
3

ionic cordova resources depends on ionic server and could be failed because of network issues or ionic server issues. Just confirm that icon and splash files are put into PROJECT_FOLDER/resources, and try again. Hope this will help you, if not, maybe you could reinstall ionic.

Suriyaa
  • 2,222
  • 2
  • 25
  • 44
liuwenzhuang
  • 946
  • 7
  • 14
  • I tried, and it seems that network condition affect `ionic resources`. Thx. –  Mar 15 '16 at 08:05
  • 2
    Looks like it was an issue of ionic server. The issue got resolved automatically when I tried again after a few day. – Lokesh Sardana Mar 27 '16 at 06:19
  • Same here. It was a server error on ionic's side and instead of informing me that their broken server was broken, they just gave me a vague 404. – Ian Steffy May 13 '21 at 08:05
0

You said:

I have created a directory 'resource'

Then this is where your problem lies. It's resources not resource.

Just put the icon.png and splash.png inside the resources folder and run ionic resources.

Nikola
  • 14,888
  • 21
  • 101
  • 165
0

I had the same problem. In my case the reason was a non-quadratic splash-image. (For no reason the graphic-guy made me a splash with 2208x2205)

I changed the image to 2205x2205 and than it was working.

Witold
  • 875
  • 5
  • 5