GitHub user emv33 closed a discussion: Need help with Android adaptive icons

I'm becoming desperate trying to use an adaptive icon for my app. I used [this 
tutorial](https://www.mathew-paul.nz/posts/cordova-android-adaptive-icons/) to 
generate my icons. I copied the entire res folder into my cordova app in 
res/android. I currently have this

    <platform name="android">
        <resource-file src="res/android/values/colors.xml" 
target="/app/src/main/res/values/cdv-colors.xml" />

        <icon background="@color/white" density="mdpi" 
foreground="res/android/mipmap-mdpi/ic_launcher_foreground.webp" 
src="res/android/mipmap-mdpi/ic_launcher.webp"/>
        <icon background="@color/white" density="hdpi" 
foreground="res/android/mipmap-hdpi/ic_launcher_foreground.webp" 
src="res/android/mipmap-hdpi/ic_launcher.webp"/>
        <icon background="@color/white" density="xhdpi" 
foreground="res/android/mipmap-xhdpi/ic_launcher_foreground.webp" 
src="res/android/mipmap-xhdpi/ic_launcher.webp" />
        <icon background="@color/white" density="xxhdpi" 
foreground="res/android/mipmap-xxhdpi/ic_launcher_foreground.webp" 
src="res/android/mipmap-xxhdpi/ic_launcher.webp" />
        <icon background="@color/white" density="xxxhdpi" 
foreground="res/android/mipmap-xxxhdpi/ic_launcher_foreground.webp" 
src="res/android/mipmap-xxxhdpi/ic_launcher.webp" />
    </platform>

(I changed colors.xml to cdv-colors.xml because of [this bug in the 
documentation](https://github.com/apache/cordova-android/issues/1728#issuecomment-2260716355)
 that is still there)

I get the following error:

    * What went wrong:
    Execution failed for task ':app:processDebugResources'.
    > A failure occurred while executing 
com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
      > Android resource linking failed
        ERROR: 
D:\my-app\platforms\android\app\src\main\res\mipmap-mdpi-v26\ic_launcher.xml:4: 
AAPT: error: resource mipmap/ic_launcher_foreground (aka 
my.app:mipmap/ic_launcher_foreground) not found.

        ERROR: 
D:\my-app\platforms\android\app\src\main\res\mipmap-hdpi-v26\ic_launcher.xml:4: 
AAPT: error: resource mipmap/ic_launcher_foreground (aka 
my.app:mipmap/ic_launcher_foreground) not found.

        ERROR: 
D:\my-app\platforms\android\app\src\main\res\mipmap-xhdpi-v26\ic_launcher.xml:4:
 AAPT: error: resource mipmap/ic_launcher_foreground (aka 
my.app:mipmap/ic_launcher_foreground) not found.

        ERROR: 
D:\my-app\platforms\android\app\src\main\res\mipmap-xxhdpi-v26\ic_launcher.xml:4:
 AAPT: error: resource mipmap/ic_launcher_foreground (aka 
my.app:mipmap/ic_launcher_foreground) not found.

        ERROR: 
D:\my-app\platforms\android\app\src\main\res\mipmap-xxxhdpi-v26\ic_launcher.xml:4:
 AAPT: error: resource mipmap/ic_launcher_foreground (aka 
my.app:mipmap/ic_launcher_foreground) not found.


This is my file tree in res/android:

    ├───drawable
    ├───drawable-anydpi
    │       ic_play.xml
    │
    ├───drawable-hdpi
    │       ic_play.png
    │
    ├───drawable-mdpi
    │       ic_play.png
    │
    ├───drawable-xhdpi
    │       ic_play.png
    │
    ├───drawable-xxhdpi
    │       ic_play.png
    │
    ├───mipmap-anydpi
    ├───mipmap-anydpi-v26
    │       ic_banner.xml
    │       ic_channel.xml
    │       ic_launcher.xml
    │       ic_launcher_round.xml
    │
    ├───mipmap-hdpi
    │       ic_launcher.webp
    │       ic_launcher_foreground.webp
    │       ic_launcher_round.webp
    │
    ├───mipmap-mdpi
    │       ic_launcher.webp
    │       ic_launcher_foreground.webp
    │       ic_launcher_round.webp
    │
    ├───mipmap-xhdpi
    │       ic_banner.png
    │       ic_banner_foreground.png
    │       ic_channel.png
    │       ic_channel_foreground.png
    │       ic_launcher.webp
    │       ic_launcher_foreground.webp
    │       ic_launcher_round.webp
    │
    ├───mipmap-xxhdpi
    │       ic_launcher.webp
    │       ic_launcher_foreground.webp
    │       ic_launcher_round.webp
    │
    ├───mipmap-xxxhdpi
    │       ic_launcher.webp
    │       ic_launcher_foreground.webp
    │       ic_launcher_round.webp
    │
    ├───values
    │       colors.xml
    │       ic_banner_background.xml
    │       ic_channel_background.xml
    │       ic_launcher_background.xml
    │       strings.xml
    │       themes.xml
    │
    ├───values-night
    │       themes.xml
    │
    └───xml
            backup_rules.xml
            data_extraction_rules.xml

(I deleted the contents of drawable because it contained default icons. Also, 
ic_play is a notification icon that is unrelated to this issue)

GitHub link: https://github.com/apache/cordova/discussions/543

----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscr...@cordova.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to