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

后端 未结 12 1051
梦毁少年i
梦毁少年i 2020-12-28 14:26

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

相关标签:
12条回答
  • 2020-12-28 15:16

    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.

    0 讨论(0)
  • 2020-12-28 15:16

    You can add your resources again by running:

    ionic integrations enable cordova --add
    
    0 讨论(0)
  • 2020-12-28 15:17

    Just remove <preference name="Orientation" value="portrait" /> in config.xml file and run ionic cordova resources.

    Problem is when you run ionic cordova resources it is only generates the resources for portrait orientation.

    0 讨论(0)
  • 2020-12-28 15:19

    I resolved the error using the way similar to Fakan. You just need to change the icon tag with src="resources\android\icon\drawable-hdpi.png" outside the platform tags to "resources\icon.png" to resolve this error

    0 讨论(0)
  • 2020-12-28 15:20

    In config.xml, I changed the resources\android\icon\drawable-hdpi.png to resources resources\android\icon\drawable-hdpi.png

    0 讨论(0)
  • 2020-12-28 15:23

    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.

    0 讨论(0)
提交回复
热议问题