I found there were numerous vector drawable crashes happened on pre-Lollipop devices and I can’t reproduce it.

One is caused by **org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector** when I use `setImageResource`

```
android.content.res.Resources$NotFoundException: File res/drawable/ic_mylib_offline_tracks_32.xml from drawable resource ID #0x7f020414
        at android.content.res.Resources.loadDrawable(Resources.java:2141)
        at android.content.res.Resources.getDrawable(Resources.java:711)
        at android.support.v7.widget.VectorEnabledTintResources.superGetDrawable(VectorEnabledTintResources.java:74)
        at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:433)
        at android.support.v7.widget.VectorEnabledTintResources.getDrawable(VectorEnabledTintResources.java:67)
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:360)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
        at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
        at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:85)
        at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:93)
...

```

Code:

```
@override
protected void onBindItemViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
    ...    
    viewHoler.imageView.setImageResource(vectorResId);
    ...
}

```

Vector drawable - **ic\_mylib\_offline\_tracks\_32.xml**:

```
<vector android:height="24dp" android:viewportHeight="32.0"
    android:viewportWidth="32.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M7,21v3.75c0,0.69 0.54,1.25 1.2,1.25h15.6c0.66,0 1.2,-0.56 1.2,-1.25V21M19,17l-3,2 -3,-2M16,6v12"
        android:strokeColor="#A0A098" android:strokeLineCap="round"
        android:strokeLineJoin="round" android:strokeWidth="1"/>
</vector>

```

And the others caused by **android.content.res.Resources$NotFoundException: File res/drawable/ic\_more\_white\_24.xml from drawable resource ID #0x7f020357. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.** when I refresh toolbar menu visibility.

```
android.content.res.Resources$NotFoundException: File res/drawable/ic_more_white_24.xml from drawable resource ID #0x7f020357. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
        at android.content.res.Resources.loadDrawable(Resources.java:2096)
        at android.content.res.Resources.getDrawable(Resources.java:700)
        at android.support.v7.widget.VectorEnabledTintResources.superGetDrawable(VectorEnabledTintResources.java:74)
        at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:435)
        at android.support.v7.widget.VectorEnabledTintResources.getDrawable(VectorEnabledTintResources.java:67)
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:353)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
        at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
        at android.support.v7.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:491)
        at android.support.v7.view.menu.ActionMenuItemView.initialize(ActionMenuItemView.java:125)
        at android.support.v7.widget.ActionMenuPresenter.bindItemView(ActionMenuPresenter.java:210)
        at android.support.v7.view.menu.BaseMenuPresenter.getItemView(BaseMenuPresenter.java:187)
        at android.support.v7.widget.ActionMenuPresenter.getItemView(ActionMenuPresenter.java:196)
        at android.support.v7.widget.ActionMenuPresenter.flagActionItems(ActionMenuPresenter.java:476)
        at android.support.v7.view.menu.MenuBuilder.flagActionItems(MenuBuilder.java:1164)
        at android.support.v7.view.menu.BaseMenuPresenter.updateMenuView(BaseMenuPresenter.java:95)
        at android.support.v7.widget.ActionMenuPresenter.updateMenuView(ActionMenuPresenter.java:229)
        at android.support.v7.view.menu.MenuBuilder.dispatchPresenterUpdate(MenuBuilder.java:291)
        at android.support.v7.view.menu.MenuBuilder.onItemsChanged(MenuBuilder.java:1051)
        at android.support.v7.view.menu.MenuBuilder.onItemVisibleChanged(MenuBuilder.java:1090)
        at android.support.v7.view.menu.MenuItemImpl.setVisible(MenuItemImpl.java:651)
...

```

Code:

```
public void refreshMenuItemVisibility(boolean visibility) {
    toolbar.getMenu().findItem(R.id.menu_overflow).setVisible(visible);
}

```

Vector drawable - **ic\_more\_white\_24.xml**:

```
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="32dp"
    android:height="32dp"
    android:viewportWidth="32.0"
    android:viewportHeight="32.0">
    <path
        android:pathData="M10.5,16.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"
        android:fillType="evenOdd"
        android:fillColor="#FFFFFF"/>
    <path
        android:pathData="M16.5,16.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"
        android:fillType="evenOdd"
        android:fillColor="#FFFFFF"/>
    <path
        android:pathData="M22.5,16.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"
        android:fillType="evenOdd"
        android:fillColor="#FFFFFF"/>
</vector>

```

I have already followed the step from the official document, but it doesn't work.

```
vectorDrawables.useSupportLibrary = true

public class MainActivity extends AppCompatActivity {
    static {
        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    }
}

```

My library and tools version are as follow:

* Android Support Library: 26.0.0
* Build Tools: 26.0.0
* Gradle: 3.3
* Android Plugin: 2.3.3

### UPDATE

All of the vectors are put in `drawable` folder.