Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Adaptive Icon Linking File Resources Error

I used android studio to generate my image assets and moved the files over to res/android and followed the changes to the config.xml outlined here : Android Oreo - how do I set Adaptive Icons in Cordova?

Right off the bat I get an error: Source path does not exist: res/android/drawable/ic_launcher_background.xml as my image asset did not generate a drawable folder. If I comment out the lines:

<!-- <resource-file src="res/android/drawable/ic_launcher_background.xml" target="app/src/main/res/drawable/ic_launcher_background.xml" /> -->
<!-- <resource-file src="res/android/drawable/ic_launcher_foreground.xml" target="app/src/main/res/drawable/ic_launcher_foreground.xml" /> -->

the build is able to begin but I receive linking errors:

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  /home/jaimeandres/git/firebones/FireBonesMobileApp/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:4: AAPT: error: resource mipmap/ic_launcher_foreground (aka com.firebones.app:mipmap/ic_launcher_foreground) not found.

  /home/jaimeandres/git/firebones/FireBonesMobileApp/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:4: AAPT: error: resource mipmap/ic_launcher_foreground (aka com.firebones.app:mipmap/ic_launcher_foreground) not found.

  error: failed linking file resources.

below are the resources generated by Android Studio

Image of resources generated

like image 730
andresmonc Avatar asked Jan 27 '26 13:01

andresmonc


1 Answers

Had to individually add foreground.png to each dpi


    <platform name="android">
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
        </edit-config>
        <resource-file src="res/android/values/ic_launcher_background.xml" target="app/src/main/res/values/ic_launcher_background.xml" />
        <!-- <resource-file src="res/android/drawable/ic_launcher_foreground.xml" target="app/src/main/res/drawable/ic_launcher_foreground.xml" /> -->
        <resource-file src="res/android/mipmap-anydpi-v26/ic_launcher.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" />
        <resource-file src="res/android/mipmap-anydpi-v26/ic_launcher_round.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" />
        <!-- hdpi -->
        <resource-file src="res/android/mipmap-hdpi/ic_launcher.png" target="app/src/main/res/mipmap-hdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-hdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-hdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png" />
        <!-- mdpi -->
        <resource-file src="res/android/mipmap-mdpi/ic_launcher.png" target="app/src/main/res/mipmap-mdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-mdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-mdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png" />

        <!-- xhdpi -->
        <resource-file src="res/android/mipmap-xhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-xhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-xhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png" />
        <!-- xxhdpi -->
        <resource-file src="res/android/mipmap-xxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-xxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-xxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png" />
        <!-- xxxhdpi -->
        <resource-file src="res/android/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-xxxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-xxxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png" />
    </platform>  

like image 183
andresmonc Avatar answered Jan 29 '26 03:01

andresmonc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!