I get this crash only on API 22 and 23 devices.
(android.content.res.Resources$NotFoundException: File res/drawable/show_empty_state.xml from drawable resource ID #0x7f080156 at android.content.res.Resources.loadDrawableForCookie(Resources.java:2640) at android.content.res.Resources.loadDrawable(Resources.java:2540) at android.content.res.Resources.getDrawable(Resources.java:806) at android.content.Context.getDrawable(Context.java:458) at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:358) at com.myProj.utils.EmptyStateView.setImage(EmptyStateView.java:55) at com.myProj.tab_two.ShowFragment.onCreateView(ShowFragment.java:111) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2261)
The resource is definitely there and it works fine on higher devices. The only recent change i did was replace a new vector image using SVG for show_empty_state. I did look at some other related questions. Could not find an answer so far. Any help is appreciated. Thanks.
The crash was because the vector asset had
gradient
tag for <24 devices.Replacing the
with
fixes it.
Better would be to replace the asset with a non-gradient one for <24 sdk.
You need to be sure that inside path tag of your vector drawable you are using fill color as hexcode rather then any reference to color file.
For example:
You need to use
instead of