Adaptive icons not working in Oreo - why?

677 views Asked by At

I'm trying to add a custom icon from an SVG file to my Android app by right-clicking on the res folder -> new -> Image asset. I have selected the default options, using my SVG but I can't see the icon when I'm running the app. I have tried to do a clean project before installing it and also an invalidate cache and restart and the result is the same.

I've also realized that mipmap-anydpi-v26/ic_launcher.xml shows the default icon I'm seeing when my app is installed. This file contains:

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

when clicking on the @drawable/ic_launcher_foreground I get to locations to open: drawable and drawable-24. The first one shows my recently updated icon, but drawable-24 shows the default Android icon I see when installing my app.

Is there anything I'm missing here? Anything else I have to do?

Thanks!

2

There are 2 answers

1
noloman On BEST ANSWER

Well, in the end, I just created the icons from a PNG instead an SVG and it works great.

0
RomanMitasov On

drawable-24 folder has higher priority than drawable.

Api-specific resources, along with resolution-specific and language-specific are always more preferrable by Android than unspecified resources.