title: Error inflating class <unknown> - Android
body: <p>I am working on an Android App , Here I am working with RecyclerView . I have an item.xml for RecyclerView .</p>
  
  <p><strong>item.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;android.support.v7.widget.CardView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:cardView="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/userpopstcardview"
      android:layout_marginTop="10dp"
      android:layout_marginBottom="10dp"
      android:layout_marginRight="10dp"
      android:layout_marginLeft="10dp"
      cardView:cardElevation="2dp"
      cardView:cardCornerRadius="5dp"
      cardView:cardBackgroundColor="#fff"
      &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@drawable/listview_corner"
          android:orientation="vertical"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"&gt;
  
              &lt;de.hdodenhof.circleimageview.CircleImageView
                  android:layout_width="70dp"
                  android:layout_height="70dp"
                  android:src="@drawable/user_placeholder"
                  android:layout_margin="10dp"
                  android:id="@+id/circleView"
                  /&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:layout_gravity="center"
                  android:layout_marginLeft="5dp"&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"&gt;
                      &lt;TextView
                          android:id="@+id/name"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:textColor="#000"
                          android:text="Jasmine"
                          android:textSize="20sp"
                          android:textStyle="bold"
                          /&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:layout_marginTop="5dp"&gt;
                      &lt;LinearLayout
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"&gt;
                          &lt;TextView
                              android:id="@+id/location"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:textColor="#929292"
                              android:maxLines="2"
                              android:textSize="14sp"
                              android:textStyle="normal"
                              /&gt;
                      &lt;/LinearLayout&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="horizontal"&gt;
                          &lt;TextView
                              android:id="@+id/time"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:textColor="#929292"
                              android:text=""
                              android:textSize="14sp"
                              android:textStyle="normal"
                              /&gt;
                          &lt;TextView
                              android:id="@+id/hours_minuts"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:textColor="#929292"
                              android:text=""
                              android:textSize="14sp"
                              android:textStyle="normal"
                              android:layout_marginLeft="5dp"
                              android:layout_marginRight="5dp"/&gt;
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:textColor="#929292"
                              android:text=""
                              android:textSize="14sp"
                              android:textStyle="normal"
                              /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              &gt;
  
              &lt;TextView
                  android:id="@+id/massage"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text=""
                  android:textColor="#000"
                  android:padding="10dp"
                  android:textSize="16sp" /&gt;
  
              &lt;FrameLayout
                  android:layout_width="match_parent"
                  android:layout_height="200dp"
                  android:background="#303030"&gt;
  
                  &lt;ImageView
                      android:id="@+id/attachment"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:adjustViewBounds="true"
                      android:scaleType="centerCrop"
                      android:tint="#00000000"
                      /&gt;
  
                  &lt;RelativeLayout
                      android:layout_width="match_parent"
                      android:layout_height="@dimen/player_toolbar"
                      android:background="#30000000"
                      android:layout_gravity="bottom"
                      android:theme="@style/Base.ThemeOverlay.AppCompat.Dark.ActionBar"
                      &gt;
  
                      &lt;TextView
                          android:id="@+id/audioTime"
                          android:text="00:00"
                          android:paddingLeft="8dp"
                          android:paddingRight="8dp"
                          android:layout_width="wrap_content"
                          android:layout_height="@dimen/avatar_size"
                          android:layout_alignParentRight="true"
                          android:gravity="center"/&gt;
  
                      &lt;RelativeLayout
                          android:id="@+id/player_control"
                          android:layout_alignParentLeft="true"
                          android:layout_width="@dimen/avatar_size"
                          android:layout_height="@dimen/avatar_size"
                          android:layout_marginLeft="10dp"
                          &gt;
  
                          &lt;ImageView
                              android:id="@+id/player_state"
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"
                              android:src="@drawable/play"
                              android:tint="#00000000"
                              /&gt;
  
                      &lt;/RelativeLayout&gt;
  
                      &lt;TextView
                          android:id="@+id/selected_title"
                          android:text=""
                          android:paddingLeft="8dp"
                          android:layout_toLeftOf="@id/audioTime"
                          android:layout_toRightOf="@id/player_control"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"/&gt;
                  &lt;/RelativeLayout&gt;
  
              &lt;/FrameLayout&gt;
          &lt;/LinearLayout&gt;
  
  
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              android:padding="10dp"
              android:background="#fff"&gt;
              &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"&gt;
                  &lt;TextView
                      android:id="@+id/likespoints"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="0"
                      android:textColor="#929292"
                      android:textSize="14sp"/&gt;
                  &lt;TextView
                      android:id="@+id/likeList"
                      android:background="@drawable/textview_effect"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Likes"
                      android:textColor="#929292"
                      android:textSize="14sp"
                      android:layout_marginLeft="5dp"/&gt;
  
              &lt;/LinearLayout&gt;
              &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"
                  android:layout_marginLeft="30dp"&gt;
                  &lt;TextView
                      android:id="@+id/commentspoints"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="0"
                      android:textColor="#929292"
                      android:textSize="14sp"/&gt;
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Comments"
                      android:textColor="#929292"
                      android:textSize="14sp"
                      android:layout_marginLeft="5dp"/&gt;
  
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_height="0.5dp"
              android:layout_width="match_parent"&gt;
              &lt;View
                  android:layout_width="match_parent"
                  android:layout_height="0.5dp"
                  android:background="#eeeeee"/&gt;
          &lt;/LinearLayout&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:orientation="horizontal"
              android:weightSum="3"&gt;
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_weight="1"&gt;
                  &lt;TextView
                      android:id="@+id/like"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:text="Like"
                      android:gravity="center"
                      android:layout_gravity="center"
                      android:textSize="14sp"
                      android:textColor="#929292"
                      android:padding="10dp"
                      android:clickable="true"
                      android:background="@drawable/textview_effect"/&gt;
              &lt;/LinearLayout&gt;
              &lt;LinearLayout
                  android:layout_height="match_parent"
                  android:layout_width="0.5dp"&gt;
                  &lt;View
                      android:layout_width="0.5dp"
                      android:layout_height="match_parent"
                      android:background="#eeeeee"/&gt;
              &lt;/LinearLayout&gt;
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_weight="1"&gt;
                  &lt;TextView
                      android:id="@+id/comment"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:text="Comment"
                      android:gravity="center"
                      android:layout_gravity="center"
                      android:textSize="14sp"
                      android:textColor="#929292"
                      android:padding="10dp"
                      android:clickable="true"
                      android:background="@drawable/textview_effect"/&gt;
              &lt;/LinearLayout&gt;
              &lt;LinearLayout
                  android:layout_height="match_parent"
                  android:layout_width="0.5dp"&gt;
                  &lt;View
                      android:layout_width="0.5dp"
                      android:layout_height="match_parent"
                      android:background="#eeeeee"/&gt;
              &lt;/LinearLayout&gt;
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_weight="1"&gt;
                  &lt;TextView
                      android:id="@+id/share"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:text="Share"
                      android:gravity="center"
                      android:layout_gravity="center"
                      android:textSize="14sp"
                      android:textColor="#929292"
                      android:padding="10dp"
                      android:clickable="true"
                      android:background="@drawable/textview_effect"/&gt;
              &lt;/LinearLayout&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  
  <p>I have inflated item.xml using following code in <strong>onCreateViewHolder(ViewGroup viewGroup, int viewType)</strong> </p>
  
  <pre><code>View itemViewTextAudio = inflater.inflate(R.layout.item, viewGroup, false);
  </code></pre>
  
  <p>But it is crashing at above line . I have visited many posts on Stackoverflow ,but no luck .</p>
  
  <p>LogCat :</p>
  
  <pre><code>Process: com.musomeet, PID: 27659
  android.view.InflateException: Binary XML file line #150: Binary XML file line #150: Error inflating class &lt;unknown&gt;
  at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
  at com.adapter.UserPostAdapter.onCreateViewHolder(UserPostAdapter.java:340)
  at com.adapter.UserPostAdapter.onCreateViewHolder(UserPostAdapter.java:30)
  at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5288)
  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4551)
  at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4461)
  at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1962)
  at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1371)
  at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1334)
  at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:563)
  at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2847)
  at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3145)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
  at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
  at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
  at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
  at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
  at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
  at android.view.View.layout(View.java:16636)
  at android.view.ViewGroup.layout(ViewGroup.java:5437)
  at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
  at android.view.Choreographer.doCallbacks(Choreograph
  </code></pre>
  
  <p><strong>Edit :</strong></p>
  
  <p>item.xml is displaying perfectly on Lollipop based devices but it is not being displayed on <strong>Huawei Nexus 6P</strong> which is Marshmallow based Android phone .</p>
  
  <p>Note : When I try setContentView(R.layout.item) then works fine on <strong>Huawei Nexus 6P</strong> .
  but It is throwing error when using with following code :</p>
  
  <pre><code>View itemViewTextAudio = inflater.inflate(R.layout.item, viewGroup, false);
  </code></pre>