当使用支持库v23.1.1插件并在Android 4.4.4(API 19)下运行时,该应用程序运行正常:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
但是当我使用它构建它时 较新版本(23.2) android支持库崩溃:
XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
当应用想要使用简单的自定义视图来充气警报对话框时会发生这种情况。自定义视图使用包含a的XML文件 <shape> 标记作为其drawable之一。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid
    android:color="@android:color/white" >
</solid>
<corners
    android:radius="5dp">
</corners>
<stroke android:width="1dp" android:color="@color/AppColor" />
</shape> 
虽然我无法在崩溃日志中明确指出这个基于SVG的drawable,但我的猜测是因为谷歌引入了支持 VectorDrawables,它以某种方式与我的应用程序发生冲突。
任何有关如何查明罪魁祸首的提示或输入都表示赞赏。
             
            
            
            
我遇到了类似的问题。我得到了同样的错误,因为我在设置ImageView的源代码时仍然使用android:src属性而不是app:srcCompat
在您引用矢量drawable的任何地方更改此属性都可以解决您的问题。
旧:
<ImageView
  android:layout_width="wrap_content"  
  android:layout_height="wrap_content"  
  android:src="@drawable/ic_add" />
新:
<ImageView
  android:layout_width="wrap_content"  
  android:layout_height="wrap_content"  
  app:srcCompat="@drawable/ic_add" />
 
                
原来有两个不同的问题:
- 我正在使用平原 
RadioButton 在我的XML文件中。将其更改为 android.support.v7.widget.AppCompatRadioButton 解决了这个问题。 
其次,正如博客文章所暗示我必须将一些可绘制的内容包装进去 容器 drawables所以支持库可以在进行基于矢量的绘图时使用它们。例如,在我的一个自定义按钮中,我保存了基于矢量的背景 dialog_bg.xml, button_round_bg.xml 和 button_round_bg_2.xml。
为了解决这个问题,我必须将它们放在其中一个容器中(例如 州名单, 插页 要么 LevelList)。这个包装器被保存到一个名为的文件夹中 vector_wrapper.xlm:
 
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:drawable="@drawable/dialog_bg"
        android:maxLevel="1"
        android:minLevel="1" />
    <item
        android:drawable="@drawable/button_round_bg"
        android:maxLevel="2"
        android:minLevel="2" />
    <item
        android:drawable="@drawable/button_round_bg_2"
        android:maxLevel="3"
        android:minLevel="3" />
</level-list>
现在我要改变我的自定义按钮的背景说
<customButton
    android:background="@drawable/vector_wrapper"
</customButton>
由于包装器现在有三个drawable,我可以根据我的需要在Java代码中选择它们:
customButton btnSave = (customButton) view.findViewById(R.id.btnSave);
btnSave.getBackground().setLevel(3);
如果您的视图是,则不需要容器包装器 Image基于视图的视图 其他答案 由@themichaelscott建议,在这种情况下只需将src更改为 app:srcCompat="@drawable/ic_add"