2 Replies Latest reply on Apr 19, 2016 1:22 PM by dans8649804

    android build results in error 'no resource found' for icon

    dans8649804

      Hi,

       

      I am trying to build an app using the Phonegap CLI that I have previously been building using Phonegap Desktop and Phonegap Build.  I am running the following command:

       

      phonegap build android --debug

       

      this outputs:

       

      Execution failed for task ':processDebugResources'.

       

       

      > com.android.ide.common.internal.LoggedErrorException: Failed to run command:

              C:\Users\WENDALL\AppData\Local\Android\sdk\build-tools\23.0.3\aapt.exe p

      ackage -f --no-crunch -I C:\Users\WENDALL\AppData\Local\Android\sdk\platforms\an

      droid-22\android.jar -M C:\Users\WENDALL\workspace\golddigger\platforms\android\

      build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\WENDALL

      \workspace\golddigger\platforms\android\build\intermediates\res\debug -A C:\User

      s\WENDALL\workspace\golddigger\platforms\android\build\intermediates\assets\debu

      g -m -J C:\Users\WENDALL\workspace\golddigger\platforms\android\build\generated\

      source\r\debug -F C:\Users\WENDALL\workspace\golddigger\platforms\android\build\

      intermediates\res\resources-debug.ap_ --debug-mode --custom-package com.ruxed.go

      lddigger -0 apk --output-text-symbols C:\Users\WENDALL\workspace\golddigger\plat

      forms\android\build\intermediates\symbols\debug

      Error Code:

              1

      Output:

              C:\Users\WENDALL\workspace\golddigger\platforms\android\build\intermedia

      tes\manifests\full\debug\AndroidManifest.xml:24: error: Error: No resource found

      that matches the given name (at 'icon' with value '@drawable/icon').

       

      In looking at the manifest document referenced, the line in question is:

       

          <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true" >

       

      I believe that these xml files get built by phonegap so editing them probably would not change anything as they are overwritten.  I don't see any details about this error or anything that I am doing wrong in my phonegap config.xml file regarding the app's icons according to the documentation.  Within my app's config.xml file, I have the following set up for icons:

       

      <platform name="android">

        <allow-intent href="market:*" />

        <icon src="img/36.png" qualifier="ldpi" />

        <icon src="img/48.png" qualifier="mdpi" />

        <icon src="img/72.png" qualifier="hdpi" />

        <icon src="img/96.png" qualifier="xhdpi" />

        <icon src="img/144.png" qualifier="xxhdpi" />

        <icon src="img/192.png" qualifier="fr-xxhdpi" />

      </platform>

      <platform name="ios">

        <allow-intent href="itms:*" />

        <allow-intent href="itms-apps:*" />

        <icon src="img/icon-180.png" width="180" height="180" />

        <icon src="img/60.png" width="60" height="60" />

        <icon src="img/120.png" width="120" height="120" />

        <icon src="img/76.png" width="76" height="76" />

        <icon src="img/152.png" width="152" height="152" />

        <icon src="img/29.png" width="29" height="29" />

        <icon src="img/58.png" width="58" height="58" />

        <icon src="img/40.png" width="40" height="40" />

        <icon src="img/80.png" width="80" height="80" />

      </platform>

       

      All of these icon files are within my app at /www/img and the app is build-able using Phonegap Build, complete with launcher icons working as expected.

       

      Is there anything I can do to get past this error and get my app compiled, or at least moved on to the next error message to troubleshoot?  Thanks for any help.

        • 1. Re: android build results in error 'no resource found' for icon
          joe_bowser Adobe Employee (Admin)

          Hey

           

          Cordova and PhoneGap have different properties for their XML than PhoneGap Build.  To get this to work, you need to change the icon tags to use the density property, like this:

           

          <icon src="img/36.png" density="ldpi" />

           

          PhoneGap does not modify that part of the AndroidManifest.xml, since the drawable resource has to all have the same name for the icon to appear on all the screen densities.

          • 2. Re: android build results in error 'no resource found' for icon
            dans8649804 Level 1

            Hi and thanks for the response.  I have updated my config.xml to reflect your suggested changes but am not seeing an change in the result of running the 'phonegap build android' command on the project.  Here is the altered config.xml bits:

             

            <platform name="android">

            <allow-intent href="market:*" />

            </platform>

            <icon src="img/36.png" platform="android" density="ldpi" />

            <icon src="img/48.png" platform="android" density="mdpi" />

            <icon src="img/72.png" platform="android" density="hdpi" />

            <icon src="img/96.png" platform="android" density="xhdpi" />

            <icon src="img/144.png" platform="android" density="xxhdpi" />

            <icon src="img/192.png" platform="android" density="fr-xxhdpi" />

             

            I have tried placing these icon elements within the platform element for android (as shown here: PhoneGap Build Documentation ), as well as placing them as they are above (outside the platform element, and including the platform attribute in the icon element instead).  Neither of these approaches seem to have changed the output of the build operation, and I am receiving the same error about my AndroidManifest.xml file.

             

            I also removed all icon elements from my config.xml file, and this also did not change the situation.  It appears that even without any icon tags the problem persists.

             

            My best guess is that the icon.png file is missing, but I'm not sure how I would create or place it using the phonegap CLI.  I don't see anything in the documentation about this or other conversations about this specific to phonegap or cordova.  There are examples of this using Android Studio or Eclipse to edit the Android project files, but to my understanding this isn't how I should be doing it with Phonegap.  Am I wrong?  Does anyone know how to place or create this icon.png file to get me past this?

             

            Thanks for any additional help.