Legacy icon does not show when using adaptive icon
Solution is to have mipmap-anydpi-v26/ic_launcher.xml
for adaptive icons applicable for API level 26 and above and for other API levels put ic_launcher.png
(Note: Not ic_launcher.xml) in all mimpap folders.
Explanation:
Here is the basic problem mipmap-anydpi
take precedence over all other mipmap-*
. So if resource is found in mipmap-anydpi
it will always take preference. Now mipmap-anydpi-v26
is a filter above this which says resources from mipmap-anydpi-v26
will always be picked irrespective of devices density only if API level is 26 or more (Oreo).
Now you manifest has android:icon="@mipmap/ic_launcher"
If your device has API level 26 or above android will choose to use mipmap-anydpi-v26/ic_launcher.xml
and everything works fine.
The problem happens when API level is less than 26. Android stats looking for resource named ic_launcher
. It will never go and search in mipmap-anydpi-v26
because of API level constraint. Next, it would look for the resource in mipmap-anydpi
and if not there then the actual density resource Eg. mipmap-mdpi
.
Next, you cannot give ic_launcher.xml
to android devices less than sdk 26 because it does not know what adaptive icons is.
So the solution is to have mipmap-anydpi-v26/ic_launcher.xml
for adaptive icons applicable for API level 26 and above and for other API levels put ic_launcher.png
(Note: Not ic_launcher.xml) in all mimpap folders.
I have been faced same issue and resolved as below.
Put your ic_launcher.xml
and ic_launcher_round.xml
should be in mipmap-anydpi-v26 (make sure you should not have ic_launcher.png/jpg
or ic_launcher_round.png/jpg
in same folder).
Put your ic_launcher.png
should be in mipmap-hdpi/mdpi/xhdpi/xxhdpi/xxxhdpi (make sure you should not have ic_launcher.xml
and ic_launcher_round.xml
in these same folder).
By doing this, You will not get any errors building/running project.
Hope it helps some one who are same issue...
I had the same trouble, and solved it by renaming my mipmap-anydpi
directory to mipmap-anydpi-v26
.
Apparently the ic_launcher.xml
file confuses older Android versions, and this hides it from all but O. At any rate, my icons now work on all versions (down to SDK 11, at least).