5

When creating an launcher icon (Adaptive and Legacy) in a Image Asset Studio with a Clip Art, images are created in the mipmap folder:

enter image description here

But for anydpi-v26, the standard icon for the foreground does not change, although the background color has changed:

enter image description here

ic_launcher.xml(anydpi-v26):

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

there are two files in the ic_launcher_foreground folder: ic_launcher_foregraund.xml (new icon) and ic_launcher_foregraund.xml (v24) (standard icon)

Why doesn't he change to a new drawing automatically? Thanks for any answer!

alexrnov
  • 2,346
  • 3
  • 18
  • 34

4 Answers4

5

I had the same issue. Same solution. For some reason, the old file ic_launcher_foreground.xml is not deleted in the drawable folder when creating the new launcher icon. You end up with two files having the same name. So deleting it (without safe delete), solves the problem.

fab2vo
  • 76
  • 1
  • 3
  • 2
    It is worth to mention, that sometimes if you delete files and recreate them, Android Studio throws resource linkink errors. `Build` -> `Rebuild project` solves the problem. – Nekomajin42 Jul 21 '21 at 22:15
3

I removed the ic_launcher_foreground.xml(v24) file from folder: res/drawable/ic_launcher_foreground/, which remained from the standard icon.

This action solved the problem:

enter image description here

alexrnov
  • 2,346
  • 3
  • 18
  • 34
  • I came here with the same problem, however I'm concerned that this "answer" is just a bandaid fix and will cause problems on certain phones/apis. I am not an expert by any means. Any thoughts on the side-effects of this as a solution? – Ben Mora Jan 15 '21 at 19:08
  • Well, all it took was me trying this solution to see that it doesn't actually work. There's a lot of files that need that when building. – Ben Mora Jan 15 '21 at 19:21
2

I encountered this issue because one of my libraries had a launcher icon defined. Bizarrely the app module read the ic_launcher_background from the app module, but the ic_launcher_foreground from the library module.

aaronmarino
  • 3,723
  • 1
  • 23
  • 36
1

@aaronmarino's answer is right. The only solution i found to use ic_launcher_foreground from app module is to rename it to ic_launcher_foreground_something.xml

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background_something"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground_something"/>
</adaptive-icon>
tinmarfrutos
  • 1,740
  • 1
  • 14
  • 23