Recently we encountered a case where the following xml failed to be inflated on 4.x devices but work fine on 5.0 and above.
<com.pinterest.ui.text.PButton
android:id="@+id/open_in_browser_overflow_btn"
style="@style/wrap_view"
android:layout_centerVertical="true"
android:background="@drawable/ic_in_app_browser_ellipsis"
android:layout_marginTop="@dimen/list_cell_padding_topbottom"
brio:layout_marginLeft="gStart"
android:visibility="gone" />
We found the root cause if @drawable/ic_in_app_browser_ellipsis is a vector drawable, unlike in ImageView where we could use app:scrCompat to indicate the inflator to deal with the vector drawable
differently on platforms. It's just crashed inside the inflator. The solution is to load the vector drawable with ContextCompat.getDrawablein the code.
But we are wondering if the lint rule VectorRaster is able to catch this case and warn us beforehand and if there is another rule to flag such a use case. Or we'd need to write a custom rule for it.
<ImageView
android:id="@+id/board_sections_iv"
android:layout_height="@dimen/board_picker_section_image_height"
android:layout_width="wrap_content"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:contentDescription="@string/icon_search_more"
app:srcCompat="@drawable/ic_forward_arrow"
brio:layout_marginLeft="2bt"/>