Error: Source path does not exist: resources\android\icon\drawable-hdpi-icon.png

54,985

Solution 1

I had the same error, After running

ionic resources

Or

ionic cordova resources

(Based on the ionic version of your application)

it went away.

The problem was that I had Windows-style slashes (backslashes) in the path of the icon, i.e. the error I had was this:

Error: Source path does not exist: resources\android\icon\drawable-hdpi-icon.png

So, converting backslashes into slashes resolved it for me.

Hope this help to you and the others looking for same problem. It all happens because using different machines[mac & windows] for development of project like mac and windows.

Solution 2

You can add your resources again by running:

ionic integrations enable cordova --add

Solution 3

The problem is because you have:

<preference name="Orientation" value="portrait" />

in your config.xml, and when you run ionic cordova resources it is only generating the resources for portrait orientation.

Solution 4

Do not forget to add files in the resources folder.

The source image for icons should ideally be at least 1024×1024px and located at resources/icon.png. The source image for splash screens should ideally be at least 2732×2732px and located at resources/splash.png. If you used ionic start, there should already be default Ionic resources in the resources/ directory, which you can overwrite.

You need to use this formats: .png, .psd, or .ai.

You can use https://code.ionicframework.com/resources/splash.psd as a template for your splash screen and https://code.ionicframework.com/resources/icon.psd for a icon.

Solution 5

Remove all the resources tags from the config.xml and run ionic cordova resources -f. It will auto-generate all your necessary resources and tags. And you should be able to build the app.

Share:
54,985
TheoF
Author by

TheoF

Updated on March 02, 2021

Comments

  • TheoF
    TheoF about 3 years

    I'm trying to get an APK file from a Ionic project with the "cordova build --release android" command on a Mac and it doesn't work as I get this error

    "Error: Source path does not exist: resources\android\icon\drawable-hdpi-icon.png"

    . Anyone knows where it might come from?

    Here is the copy of the config.xml file :

    <?xml version='1.0' encoding='utf-8'?>
    <widget id="com.ionicframework.rise268787" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>RISE</name>
    <description>
        Discover music as you go
    </description>
    <author email="[email protected]" href="http://olivierlam.fr/">
      Olivier Lam
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="SplashScreen" value="screen" />
    <preference name="orientation" value="portrait" />
    <preference name="SplashScreenDelay" value="1000" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="1000" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <platform name="android">
        <preference name="android-minSdkVersion" value="23" />
        <preference name="android-targetSdkVersion" value="23" />
        <icon density="ldpi" src="resources\android\icon\drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources\android\icon\drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources\android\icon\drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources\android\icon\drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources\android\icon\drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources\android\icon\drawable-xxxhdpi-icon.png" />
        <splash density="port-ldpi" src="resources\android\splash\drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources\android\splash\drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources\android\splash\drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources\android\splash\drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources\android\splash\drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources\android\splash\drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/[email protected]" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/[email protected]" width="80" />
        <icon height="120" src="resources/ios/icon/[email protected]" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/[email protected]" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/[email protected]" width="120" />
        <icon height="180" src="resources/ios/icon/[email protected]" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/[email protected]" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/[email protected]" width="152" />
        <icon height="167" src="resources/ios/icon/[email protected]" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/[email protected]" width="58" />
        <icon height="87" src="resources/ios/icon/[email protected]" width="87" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
    </platform>
    <icon src="resources/ios/icon/[email protected]" />
    <plugin name="cordova-plugin-facebook4" spec="~1.7.1">
        <variable name="APP_ID" value="XXXXXXX" />
        <variable name="APP_NAME" value="Rise" />
    </plugin>
    <allow-intent href="mailto:*" />
    <allow-navigation href="*.youtube.com" />
    <plugin name="cordova-plugin-whitelist" spec="~1.2.2" />
    

    Thanks for your help.