On Android 8/9/later it fails with
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/background_splash.xml from drawable resource ID #0x7f07005e
Because it tries to load vector drawable ic_launcher_foreground.xml
(mipmap-anydpi-v26/ic_launcher.xml
) as launcher icon. bitmap
element inside item
element of course doesn’t support it (android:src
only for normal drawables) and app:srcComp
isn’t allowed to be used in this case (items
, layer-lists
)
But we can use the next solution (it works fine for Vector Drawables):
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/YOUR_COLOR"/>
<item android:drawable="@mipmap/YOUR_DRAWABLE"
android:gravity="center"/>
</layer-list>
Mb it’s better to update that blog page and mention about this issue when using bitmap