Android CheckBox 选择器中的矢量绘图 (Sdk < 21)

Android Vector Drawables in Selector for CheckBox (Sdk < 21)

所以,我一直在为我的项目添加矢量资源。而且...它们在 Lollipop 之前的 (sdk < 21) 设备上运行良好。我没有将 gradle:vectorDrawables.useSupportLibrary=true 标志添加到 build.gradle。没有将 AppComaptDelegate.setCompatVectorFromResourcesEnabled(true) 添加到 java。没有在布局中使用兼容小部件。相关的 xml 看起来像这样:

<CheckBox
      ...
      android:background="@drawable/round_checkbox"
      android:button="@null"/>

round_checkbox.xml:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@drawable/round_check_green"/>
    <item android:drawable="@drawable/round_check_gray"/>
</selector>

相关项目信息:

minSdkVersion 19
targetSdkVersion 24
compileSdkVersion 25
buildToolsVersion '25.0.2'
gradle Version 3.3
dependancies:
... [way too many, we are multidexing here]. General:
compile "com.android.support:appcompat-v7:25.3.1"

不过,我的应用程序运行良好,非常高兴,但我对它为什么没有崩溃感到困惑。 这是一个大项目,所以不能对用户进行测试。任何 thoughts/suggestions/info 将不胜感激。

经过一些经验测试,我可以确认vsatkh's assumption, AS does generate raster graphics (in build/intermediates) from vector drawables, if according gradle flag is absent. So, to use vector drawable one need to follow this tutorial,否则就是简单的栅格自动生成。