Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 264
TheoF Avatar asked Sep 26 '16 14:09

TheoF


3 Answers

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.

like image 76
MobileEvangelist Avatar answered Nov 09 '22 20:11

MobileEvangelist


You can add your resources again by running:

ionic integrations enable cordova --add
like image 15
Emiliano Avatar answered Nov 09 '22 19:11

Emiliano


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.

like image 4
Igor Aviles Avatar answered Nov 09 '22 20:11

Igor Aviles