Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9417

<icon src="icon.png"/> is ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • cordova-android
    • Android

    Description

      I don't know for iOS but for Android with CLI 5.1.1 it does not work.

      Normally when I reference an unexisting image, the build process outputs a cp command error:

          sebastien@sebastien-xps:cordova (dev *+$%)$ cordova run android --device
          cp: no such file or directory: /home/sebastien/Desktop/Stample-react/cordova/res/www/stample_splash.png
      

      But in this case there's no error at all, because I suspect Cordova to not do any CP at all. All icon src without a density are ignored, including:

      <icon src="icon.png"/> 
      <icon src="icon.png" platform="android"/>
      <platform name="android">
              <icon src="icon.png" />
              <icon src="icon.png" density="" />
      </platform>
      

      So the only solution for Android is to always use a density.

          <platform name="android">
              <icon src="www/stample_icon.png" density="ldpi" />
              <icon src="www/stample_icon.png" density="mdpi" />
              <icon src="www/stample_icon.png" density="hdpi" />
              <icon src="www/stample_icon.png" density="xhdpi" />
              <splash src="www/stample_splash.png" density="land-hdpi"/>
              <splash src="www/stample_splash.png" density="land-ldpi"/>
              <splash src="www/stample_splash.png" density="land-mdpi"/>
              <splash src="www/stample_splash.png" density="land-xhdpi"/>
              <splash src="www/stample_splash.png" density="port-hdpi"/>
              <splash src="www/stample_splash.png" density="port-ldpi"/>
              <splash src="www/stample_splash.png" density="port-mdpi"/>
              <splash src="www/stample_splash.png" density="port-xhdpi"/>
          </platform>
      

      This works fine for me and many others according to StackOverflow upvotes here: http://stackoverflow.com/questions/17820492/how-to-add-app-icon-within-phonegap-projects

      However, this never changes the picture in the APK with path "res/drawable/icon.png": this file will never be able to be replaced by a custom icon when using the config.xml declarations.

      Note this bug has already been mentionned here: https://issues.apache.org/jira/browse/CB-2606

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebastienlorber Sebastien Lorber
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: