I need to use a raster icons in API < 21, and a vector in 21+. In drawable-***dpi
I put a raster icons. In drawable-v21
, their vector counterparts with the same names.
For example, for accounts.png, I have my accounts.xml in drawable-v21
. But when I run the application on API 21+, I see that vector icons are ignored. Raster icons from drawable-***dpi
are used.
I cannot use Android Studio vector drawable compat by some reasons. Please help.
Android always prefers the resources that are the most qualified for the device and drawable-***dpi
is given a higher priority than drawable-v21
as per the table of resource qualifiers
Therefore, you should place your vector icons in the drawable-anydpi-v21
directory, which uses the anydpi
qualifier to ensure that it takes priority.