title: Error inflating class android.support.v7.widget.AppCompatTextView
body: <p>I'm developing a simple example for Vector Drawable. I used the backward compatible library <code>com.android.support:appcompat-v7:25.1.1</code> for pre-Lollipop device support.</p>
  
  <p>The views used in the layout are:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/activity_main"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.nm.vectordrawableexample.VectorActivity"&gt;
  
      &lt;ImageView android:id="@+id/ic_logo"
          android:layout_width="150dp"
          android:layout_height="150dp"
          android:layout_gravity="center_horizontal"
          android:layout_marginBottom="30dp"
          android:layout_marginTop="30dp"
          app:srcCompat="@drawable/ic_light_bulb" /&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="10dp"
          android:gravity="center_horizontal"
          android:text="Tap on icon to change tint color" /&gt;
  
      &lt;android.support.v7.widget.AppCompatImageView
          android:id="@+id/ic_android"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:layout_marginBottom="30dp" /&gt;
  
      &lt;android.support.v7.widget.AppCompatTextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:layout_marginBottom="20dp"
          android:drawableLeft="@drawable/ic_flight_takeoff"
          android:gravity="center_horizontal"
          android:text="TextView with Vector Drawable" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:text="Radio button with vector drawable icons" /&gt;
  
      &lt;RadioGroup
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:showDividers="middle"
          android:orientation="horizontal"
          android:gravity="center"&gt;
  
          &lt;android.support.v7.widget.AppCompatRadioButton
              android:id="@+id/radioBtn"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="10dp"
              android:background="@drawable/radio_selector"
              android:button="@android:color/transparent" /&gt;
  
          &lt;android.support.v7.widget.AppCompatRadioButton
              android:id="@+id/radioBtn2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="10dp"
              android:background="@drawable/radio_selector"
              android:button="@android:color/transparent" /&gt;
  
          &lt;android.support.v7.widget.AppCompatRadioButton
              android:id="@+id/radioBtn3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="10dp"
              android:background="@drawable/radio_selector"
              android:button="@android:color/transparent" /&gt;
  
          &lt;android.support.v7.widget.AppCompatRadioButton
              android:id="@+id/radioBtn4"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="10dp"
              android:background="@drawable/radio_selector"
              android:button="@android:color/transparent" /&gt;
  
          &lt;android.support.v7.widget.AppCompatRadioButton
              android:id="@+id/radioBtn5"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="10dp"
              android:background="@drawable/radio_selector"
              android:button="@android:color/transparent" /&gt;
  
      &lt;/RadioGroup&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the code snippet for the activity on which a click on the ImageView changes the color of the image used in the ImageView:</p>
  
  <pre><code>public class VectorActivity extends AppCompatActivity {
  
      static {
          AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_vector);
          final AppCompatImageView icAndroid= (AppCompatImageView) findViewById(R.id.ic_android);
          icAndroid.setImageResource(R.drawable.ic_android);
          icAndroid.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Random random=new Random();
                  int color= Color.argb(255,random.nextInt(256),random.nextInt(256),random.nextInt(256));
                  icAndroid.setColorFilter(color);
              }
          });
      }
  }
  </code></pre>
  
  <p>Here is the style file content description:</p>
  
  <pre><code>&lt;resources&gt;
  
      &lt;!-- Base application theme. --&gt;
      &lt;style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt;
          &lt;!-- Customize your theme here. --&gt;
          &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
      &lt;/style&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>Now the question while executing the example on a device with Android 5.0+ (device description given below)</p>
  
  <ul>
  <li><p>ASUS Zenfone Max (Android Version 6.0).</p></li>
  <li><p>GenyMotion Emulator (Samsung Galaxy S7 Android Version 6.0 API 23)</p></li>
  </ul>
  
  <p>The example executes successfully and shows the result also.
  But while executing the same example on this device:</p>
  
  <ul>
  <li>GenyMotion Emulator HTC One 4.4.4 API 19 (480dpi)</li>
  </ul>
  
  <p>It shows a Runtime Exception and the application stopped.</p>
  
  <pre><code>FATAL EXCEPTION: main
   Process: com.nm.vectordrawableexample, PID: 1351
   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nm.vectordrawableexample/com.nm.vectordrawableexample.VectorActivity}: android.view.InflateException: Binary XML file line #38: Error inflating class android.support.v7.widget.AppCompatTextView
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
       at android.app.ActivityThread.access$800(ActivityThread.java:135)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5001)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
       at dalvik.system.NativeStart.main(Native Method)
    Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class android.support.v7.widget.AppCompatTextView
       at android.view.LayoutInflater.createView(LayoutInflater.java:620)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
       at com.nm.vectordrawableexample.VectorActivity.onCreate(VectorActivity.java:21)
       at android.app.Activity.performCreate(Activity.java:5231)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
       at android.app.ActivityThread.access$800(ActivityThread.java:135) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:136) 
       at android.app.ActivityThread.main(ActivityThread.java:5001) 
       at java.lang.reflect.Method.invokeNative(Native Method) 
       at java.lang.reflect.Method.invoke(Method.java:515) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
       at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Constructor.constructNative(Native Method)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
       at android.view.LayoutInflater.createView(LayoutInflater.java:594)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
       at com.nm.vectordrawableexample.VectorActivity.onCreate(VectorActivity.java:21) 
       at android.app.Activity.performCreate(Activity.java:5231) 
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
       at android.app.ActivityThread.access$800(ActivityThread.java:135) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:136) 
       at android.app.ActivityThread.main(ActivityThread.java:5001) 
       at java.lang.reflect.Method.invokeNative(Native Method) 
       at java.lang.reflect.Method.invoke(Method.java:515) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
       at dalvik.system.NativeStart.main(Native Method) 
    Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_flight_takeoff.xml from drawable resource ID #0x7f020055
       at android.content.res.Resources.loadDrawable(Resources.java:2096)
       at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
       at android.widget.TextView.&lt;init&gt;(TextView.java:806)
       at android.support.v7.widget.AppCompatTextView.&lt;init&gt;(AppCompatTextView.java:62)
       at android.support.v7.widget.AppCompatTextView.&lt;init&gt;(AppCompatTextView.java:58)
       at java.lang.reflect.Constructor.constructNative(Native Method) 
       at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
       at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
       at com.nm.vectordrawableexample.VectorActivity.onCreate(VectorActivity.java:21) 
       at android.app.Activity.performCreate(Activity.java:5231) 
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
       at android.app.ActivityThread.access$800(ActivityThread.java:135) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:136) 
       at android.app.ActivityThread.main(ActivityThread.java:5001) 
       at java.lang.reflect.Method.invokeNative(Native Method) 
       at java.lang.reflect.Method.invoke(Method.java:515) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
       at dalvik.system.NativeStart.main(Native Method) 
    Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
       at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
       at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
       at android.content.res.Resources.loadDrawable(Resources.java:2092)
       at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
       at android.widget.TextView.&lt;init&gt;(TextView.java:806) 
       at android.support.v7.widget.AppCompatTextView.&lt;init&gt;(AppCompatTextView.java:62) 
       at android.support.v7.widget.AppCompatTextView.&lt;init&gt;(AppCompatTextView.java:58) 
       at java.lang.reflect.Constructor.constructNative(Native Method) 
       at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
       at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
       at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
       at com.nm.vectordrawableexample.VectorActivity.onCreate(VectorActivity.java:21) 
       at android.app.Activity.performCreate(Activity.java:5231) 
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
       at android.app.ActivityThread.access$800(ActivityThread.java:135) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:136) 
       at android.app.ActivityThread.main(ActivityThread.java:5001) 
       at java.lang.reflect.Method.invokeNative(Native Method) 
       at java.lang.reflect.Method.invoke(Method.java:515) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
       at dalvik.system.NativeStart.main(Native Method) 
  </code></pre>
  
  <p>app/build.gradle file content description</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 25
      buildToolsVersion "25.0.2"
      defaultConfig {
          applicationId "com.nm.vectordrawableexample"
          minSdkVersion 15
          targetSdkVersion 25
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
          vectorDrawables.useSupportLibrary = true
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.android.support:appcompat-v7:25.1.1'
      testCompile 'junit:junit:4.12'
  }
  </code></pre>
  
  <p>What section in the code went wrong? What changes are required to run the example successfully?</p>