title: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.v7.widget.CardView with Android API 19
body: <p>I know it's a very common question and I have looked around to found a solution but nothing have helped me so far.</p>
  
  <p>I am getting this exception <strong>only WITH API level 19</strong> (my minSDKVersion is 19 and compile and targetSDK version is 25)</p>
  
  <p>I have tried with emulators running on following API level and everything works fine.</p>
  
  <pre><code>API level 25 - works
  API level 23 - works
  API level 22 - works
  API level 21 - works
  API level 19 - crashes with following exception
  </code></pre>
  
  <p>Below is the exception:</p>
  
  <pre><code>android.view.InflateException: Binary XML file line #9: Error inflating class android.support.v7.widget.CardView
  at android.view.LayoutInflater.createView(LayoutInflater.java:621)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  at com.nitinsharma.materiallistview.CardRecycleViewAdapter.onCreateViewHolder(CardRecycleViewAdapter.java:21)
  at com.nitinsharma.materiallistview.CardRecycleViewAdapter.onCreateViewHolder(CardRecycleViewAdapter.java:15)
  at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6290)
  at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5478)
  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5363)
  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5359)
  at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2141)
  at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1525)
  at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1488)
  at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:585)
  at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3506)
  at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3254)
  at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3767)
  at android.view.View.layout(View.java:14817)
  at android.view.ViewGroup.layout(ViewGroup.java:4631)
  at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
  at android.view.View.layout(View.java:14817)
  at android.view.ViewGroup.layout(ViewGroup.java:4631)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
  at android.view.View.layout(View.java:14817)
  at android.view.ViewGroup.layout(ViewGroup.java:4631)
  at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437)
  at android.view.View.layout(View.java:14817)
  at android.view.ViewGroup.layout(ViewGroup.java:4631)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
  at android.view.View.layout(View.java:14817)
  at android.view.ViewGroup.layout(ViewGroup.java:4631)
  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
  at android.view.View.layout(View.java:14817)
  at android.view.ViewGroup.layout(ViewGroup.java:4631)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
  at android.view.View.layout(View.java:14817)
  at android.view.ViewGroup.layout(ViewGroup.java:4631)
  at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
  at android.view.Choreographer.doCallbacks(Choreographer.java:574)
  at android.view.Choreographer.doFrame(Choreographer.java:544)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
  at android.os.Handler.handleCallback(Handler.java:733)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:136)
  at android.app.ActivityThread.main(ActivityThread.java:5017)
      at java.lang.reflect.Method.invokeNati
  </code></pre>
  
  <p>Below is my Gradle:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 25
      buildToolsVersion "25.0.1"
      defaultConfig {
          applicationId "com.nitinsharma.materiallistview"
          minSdkVersion 19
          targetSdkVersion 25
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      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'
          })
          testCompile 'junit:junit:4.12'
  
  
          compile 'com.android.support:cardview-v7:25.+'
          compile 'com.android.support:appcompat-v7:25.+'
          compile 'com.android.support:recyclerview-v7:25.+'
          compile 'com.android.support:cardview-v7:25.+'
          compile 'com.android.support:gridlayout-v7:25.+'
          compile 'com.android.support:support-v4:25.+'
          compile 'com.android.support:design:25.+'
      }
  
  }
  </code></pre>
  
  <p>and finally my card_view.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
  
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;android.support.v7.widget.CardView
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/bottomcardview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      card_view:cardBackgroundColor="@android:color/transparent"
      card_view:cardElevation="-1dp"
      &gt;
  
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
      &lt;android.support.v7.widget.CardView
          android:id="@+id/topcardview"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          card_view:cardBackgroundColor="@android:color/white"
          card_view:cardUseCompatPadding="true"
          card_view:cardElevation="6dp"
          card_view:cardCornerRadius="4dp"
          android:transitionName="content"
  
          &gt;
  
          &lt;ImageView
              android:id="@+id/cardImage"
              android:layout_width="100dp"
              android:layout_height="match_parent"
              android:layout_gravity="left"
              android:transitionName="image"
              /&gt;
          &lt;ImageView
              android:id="@+id/arrow"
              android:layout_width="50dp"
              android:layout_height="match_parent"
              android:layout_gravity="right|bottom"/&gt;
          &lt;TextView
              android:id="@+id/cardtext"
              android:layout_gravity="top|left"
              android:layout_marginLeft="110dp"
              android:textColor="#000"
              android:textSize="22sp"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:shadowColor="@android:color/black"
              android:fontFamily="sans-serif"
              android:elevation="4dp"
              android:textStyle="normal|bold"
              android:textAllCaps="false" /&gt;
  
          &lt;TextView
              android:id="@+id/cardtextsubs"
              android:text="Hello World"
              android:layout_marginLeft="110dp"
              android:layout_marginRight="50dp"
              android:layout_gravity="bottom"
              android:textColor="#000"
              android:textSize="13sp"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:shadowColor="@android:color/black"
              android:fontFamily="sans-serif"
              android:elevation="4dp"
              android:textStyle="normal|italic"
              android:textAllCaps="false" /&gt;
  
  
          &lt;View
              android:id="@+id/dividerLeft"
              android:layout_marginLeft="100dp"
              android:layout_width="2dp"
              android:layout_height="match_parent"
              android:elevation="8dp"
              android:background="?android:attr/listDivider"/&gt;
  
  
          &lt;/android.support.v7.widget.CardView&gt;
  
  
   &lt;/RelativeLayout&gt;
  
  &lt;/android.support.v7.widget.CardView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The line in my code where I am getting the error:</p>
  
  <pre><code>public class CardRecycleViewAdapter extends RecyclerView.Adapter&lt;CardViewHolder&gt; {
  
  
      @Override
      public CardViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          Log.d("TAG","inside oncreateviewholder");
          **View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_view,parent,false);**
          CardViewHolder viewHolder = new CardViewHolder(v,parent);
          return  viewHolder;
      }
  </code></pre>
  
  <p>My jar files:</p>
  
  <p><a href="https://i.stack.imgur.com/t30zVm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t30zVm.png" alt="enter image description here"></a></p>
  
  <p>My MainActivity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      private RecyclerView mRecycleView;
      private LinearLayoutManager mRecycleViewLayout;
      private RecyclerView.Adapter mRecycleViewAdapter;
      protected static int sizex=0;
      protected static int sizey=0;
      protected static int recycleViewHeight=0;
      protected static RecyclerView sharedRecyclerView;
      protected  static Context mContext;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          mRecycleViewLayout = new LinearLayoutManager(this);
          mRecycleViewAdapter = new CardRecycleViewAdapter();
          mRecycleView = (RecyclerView) findViewById(R.id.recycleViewRight);
          mRecycleView.setHasFixedSize(true);
          mRecycleView.setLayoutManager(mRecycleViewLayout);
          mRecycleView.setAdapter(mRecycleViewAdapter);
  
  ....
  }
  </code></pre>