Ionic cordova-res Error occurred while copying resources/android/icon/

Table of Content

Ionic cordova-res Error occurred while copying resources/android/icon/

Err info

D:\sync\websvr\ionic\current\thanhlong_binhthuan_appmobile>cordova-res android --skip-config --copy --type icon
Generated 6 resources for Android
WARN:   Error occurred while copying resources\android\icon\mdpi-foreground.png
WARN:   Error occurred while copying resources\android\icon\mdpi-background.png
WARN:   Error occurred while copying resources\android\icon\hdpi-foreground.png
WARN:   Error occurred while copying resources\android\icon\hdpi-background.png
WARN:   Error occurred while copying resources\android\icon\xhdpi-foreground.png
WARN:   Error occurred while copying resources\android\icon\xhdpi-background.png
WARN:   Error occurred while copying resources\android\icon\xxhdpi-foreground.png
WARN:   Error occurred while copying resources\android\icon\xxhdpi-background.png
WARN:   Error occurred while copying resources\android\icon\xxxhdpi-foreground.png
WARN:   Error occurred while copying resources\android\icon\xxxhdpi-background.png
Copied 20 resource items to Android

image

Fix

The following steps worked for me.

you will need to create two images manually.

Step 1

Create a 432x432 .png file. Then save it as "icon-background.png". you may decide to make the color transparent or not

In my case, I created a white image since I need a white background for my icon and I went for the 432x432 dimension.

Step 2

Create another 432x432 .png file and save it as "icon-foreground.png".

In this case, you will be mindful of the color of the background you use in the first image.

Step 3

put the two images created above into <Project Directory>/resources/android/

image

Step 4

cordova-res ios --skip-config --copy
cordova-res android --skip-config --copy

Or

cordova-res android --skip-config --copy --type icon

References

  1. https://dothanhlong.org/ionic-cordova-to-capacitor-migration/
  2. https://stackoverflow.com/questions/66026629/error-occurred-while-copying-resources-android-icon-mdpi-foreground-png

Leave a Reply

Your email address will not be published. Required fields are marked *