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

后端 未结 12 1050
梦毁少年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:05

    Just edit your config.xml file. Mine looks like this:

    <platform name="android">
        <splash density="hdpi" src="res/screen/android/screen-hdpi-landscape.png" />
        <splash density="port-hdpi" src="res/screen/android/screen-hdpi-portrait.png" />
        <splash density="ldpi" src="res/screen/android/screen-ldpi-landscape.png" />
        <splash density="port-ldpi" src="res/screen/android/screen-ldpi-portrait.png" />
        <splash density="mdpi" src="res/screen/android/screen-mdpi-landscape.png" />
        <splash density="port-mdpi" src="res/screen/android/screen-mdpi-portrait.png" />
        <splash density="xhdpi" src="res/screen/android/screen-xhdpi-landscape.png" />
        <splash density="port-xhdpi" src="res/screen/android/screen-xhdpi-portrait.png" />
    </platform>
    

    Note that res/ is relative to the project root directory. The filenames may be different at your end.

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

    Just try to find the path of this resource inside the Ionic structure. Sometimes, or in some versions, this path may be like this:

    Your resource:

    resources/android/icon/drawable-hdpi.png
    

    Try this:

    res/android/icon/drawable-hdpi.png
    
    0 讨论(0)
  • 2020-12-28 15:07

    Check your icon if it is actually saved as ".png". Not as ".PNG". Right-click on it and hit Properties.

    If it wasn't, edit your icon and save it with a file extension ".png".

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

    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.

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

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

    Note the slash change.

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

    A quick alternative answer:

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

    Is the same as

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

    or

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

    And any other in that category

    The command looks for base files namely icon-drawable.png | icon-foreground.png | icon-background.png


    in location android/resources so the best thing is to include those images in android/resources then re-run cordova build --release android or ionic cordova resources android to check

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