Issue
I am getting following error while copying icons and splash screen using cordova-res
.
I am using capacitor to build the app
I am using following command to copy the icons:
cordova-res android --skip-config --copy
here is the response of the command:
~/Public/accountech-ecommerce/ionic-files$ cordova-res android --skip-config --copy
Generated 18 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 31 resource items to Android
PS: I have followed this instruction to do that: https://capacitorjs.com/docs/guides/splash-screens-and-icons
Solution
I ran into the same error in a new Ionic [email protected] project. I had the splash.png
and icon.png
in the resources
directory. But those aren't enough. The error is related to the Adaptive Icons section for cordova-res
. 2 more icons are missing in your resources
directory.
- Add the required
icon-foreground.png
andicon-background.png
to theresources/android
directory - (Optional) Check if
cordova-res
is the latest. For me I upgraded to version 0.15.3 on a mac with this commands:sudo npm -g remove cordova-res
and thensudo npm -g install cordova-res --unsafe-perm
- Re-run the command:
cordova-res android --skip-config --copy
- Successful output now looks like (the 18 changed to 24):
Generated 24 resources for Android
Copied 31 resource items to Android
Answered By - site
Answer Checked By - Pedro (JavaFixing Volunteer)