title: support widget GridLayout error inflating
body: <p>For some reason when debugging my application on older devices (api 23, api 19) I get an error when I try to inflate the ViewHolder for my <code>RecycleView</code>'s children.</p>
  
  <p>I've tried the following:</p>
  
  <ul>
  <li>Cleaning the project  </li>
  <li>Rebuilding it  </li>
  <li>Invalidating caches and restarting</li>
  </ul>
  
  <p>I can't find the source of the issue:</p>
  
  <p>Error log:</p>
  
  <pre><code> android.view.InflateException: Binary XML file line #0: Error inflating class android.support.v7.widget.GridLayout
  </code></pre>
  
  <p>Dependancies:</p>
  
  <pre><code>dependencies {
      implementation fileTree(include: ['*.jar'], dir: 'libs')
      implementation 'com.android.support:multidex:1.0.3'
      implementation 'com.android.support:appcompat-v7:27.1.0'
      implementation 'com.android.support:gridlayout-v7:27.1.0'
      implementation 'com.android.support:design:27.1.0'
      implementation 'com.android.support.constraint:constraint-layout:1.0.2'
      implementation 'com.github.bumptech.glide:glide:3.7.0'
      implementation 'com.android.volley:volley:1.0.0'
      implementation 'com.airbnb.android:lottie:2.5.0-rc1'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.1'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
      // ViewModel and LiveData
      implementation 'android.arch.lifecycle:extensions:1.1.0'
      implementation 'android.arch.lifecycle:common-java8:1.1.0'
      // Room (use 1.1.0-alpha3 for latest alpha)
      implementation 'android.arch.persistence.room:runtime:1.0.0'
      annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
      // Paging
      implementation 'android.arch.paging:runtime:1.0.0-alpha6'
      // Test helpers for LiveData
      testImplementation 'android.arch.core:core-testing:1.1.0'
      // Test helpers for Room
      testImplementation 'android.arch.persistence.room:testing:1.0.0'
  }
  </code></pre>
  
  <p>ViewHolder:</p>
  
  <pre><code>public class ViewHolder extends RecyclerView.ViewHolder{
  
      private TextView rowTitle = null;
      private TextView rowContent = null;
      private ImageView rowImage = null;
  
      private TextView deleteText = null;
      private TextView completeText = null;
  
      private DataCommunication mData = null;
      private GlobalLists associatedItem = null;
      private GridLayout background = null;
      private GridLayout foreground = null;
  
      public ViewHolder(View itemView) {
          super(itemView);
  
          this.mData = (DataCommunication)itemView.getContext();
  
          this.background = itemView.findViewById(R.id.backRow);
          this.foreground = itemView.findViewById(R.id.foreRow);
  
          this.rowTitle = itemView.findViewById(R.id.rowTitle);
          this.rowContent = itemView.findViewById(R.id.rowContent);
  
          this.deleteText = itemView.findViewById(R.id.deleteText);
          this.completeText = itemView.findViewById(R.id.completeText);
  
          this.rowImage = itemView.findViewById(R.id.rowImage);
  
          this.foreground.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Log.d("ViewHolder", "Clicked!");
                  if (associatedItem != null)
                  {
                      mData.setItemTitle(associatedItem.getTitle());
                      if(rowContent.getText().toString().length() &gt; 0) {
                          mData.setFullContents(associatedItem.getContents());
                      }
                  }
              }
          });
  
      }
  
      public void setRowTitle(String title) {
          if (title != null) {
              this.rowTitle.setText(title);
          }
      }
  
      public void setRowContent(String content) {
          if (content != null &amp;&amp; content.length() &gt; 0) {
              this.rowContent.setText(content);
          } else {
              this.rowContent.setText("");
          }
      }
  
      public void setAssociatedItem(GlobalLists item){
          this.associatedItem = item;
      }
  
      public TextView getDeleteText() {
          return this.deleteText;
      }
  
      public TextView getCompleteText() {
          return this.completeText;
      }
  
      public GridLayout getForeground() {
          return this.foreground;
      }
  
      public GridLayout getBackground() {
          return this.background;
      }
  
  }
  
  
  
  
  import android.support.v7.widget.RecyclerView;
  import android.support.v7.widget.GridLayout;
  //other imports
  
  public class ViewHolder extends RecyclerView.ViewHolder{
  
      private TextView rowTitle = null;
      private TextView rowContent = null;
      private ImageView rowImage = null;
  
      private TextView deleteText = null;
      private TextView completeText = null;
  
      private DataCommunication mData = null;
      private GlobalLists associatedItem = null;
      private GridLayout background = null;
      private GridLayout foreground = null;
  
      public ViewHolder(View itemView) {
          super(itemView);
  
          this.mData = (DataCommunication)itemView.getContext();
  
          this.background = itemView.findViewById(R.id.backRow);
          this.foreground = itemView.findViewById(R.id.foreRow);
  
          this.rowTitle = itemView.findViewById(R.id.rowTitle);
          this.rowContent = itemView.findViewById(R.id.rowContent);
  
          this.deleteText = itemView.findViewById(R.id.deleteText);
          this.completeText = itemView.findViewById(R.id.completeText);
  
          this.rowImage = itemView.findViewById(R.id.rowImage);
  
          this.foreground.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Log.d("ViewHolder", "Clicked!");
                  if (associatedItem != null)
                  {
                      mData.setItemTitle(associatedItem.getTitle());
                      if(rowContent.getText().toString().length() &gt; 0) {
                          mData.setFullContents(associatedItem.getContents());
                      }
                  }
              }
          });
  
      }
  
      public void setRowTitle(String title) {
          if (title != null) {
              this.rowTitle.setText(title);
          }
      }
  
      public void setRowContent(String content) {
          if (content != null &amp;&amp; content.length() &gt; 0) {
              this.rowContent.setText(content);
          } else {
              this.rowContent.setText("");
          }
      }
  
      public void setAssociatedItem(GlobalLists item){
          this.associatedItem = item;
      }
  
      public TextView getDeleteText() {
          return this.deleteText;
      }
  
      public TextView getCompleteText() {
          return this.completeText;
      }
  
      public GridLayout getForeground() {
          return this.foreground;
      }
  
      public GridLayout getBackground() {
          return this.background;
      }
  
  }
  </code></pre>
  
  <p>CustomRow (ViewHolder Layout File) XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_height="110dp"
      android:layout_width="match_parent"
      android:layout_marginBottom="20dp"
      android:clickable="true"
      android:focusable="true"&gt;
  
      &lt;android.support.v7.widget.GridLayout
          android:layout_width="380dp"
          android:layout_height="match_parent"
          android:layout_gravity="center_horizontal"
          app:alignmentMode="alignMargins"
          app:useDefaultMargins="true"
          app:columnOrderPreserved="false"
          app:rowCount="1"
          app:columnCount="3"
          android:id="@+id/backRow"
          android:background="@drawable/ic_rounded_rectangle_accent"
          app:orientation="horizontal"&gt;
  
          &lt;TextView
              android:id="@+id/deleteText"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/deleteTask"
              android:textColor="@android:color/white"
              android:textStyle="bold"
              android:textSize="26sp"
              app:layout_column="2"
              app:layout_gravity="end|center_vertical"/&gt;
  
          &lt;TextView
              android:id="@+id/completeText"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/completeTask"
              android:textStyle="bold"
              android:textColor="@android:color/white"
              android:textSize="26sp"
              app:layout_column="0"
              app:layout_gravity="start|center_vertical"/&gt;
  
  
      &lt;/android.support.v7.widget.GridLayout&gt;
  
  
  
      &lt;android.support.v7.widget.GridLayout
          android:id="@+id/foreRow"
          android:layout_width="380dp"
          android:layout_height="match_parent"
          android:layout_gravity="center_horizontal"
          app:alignmentMode="alignMargins"
          app:columnOrderPreserved="false"
          app:rowCount="2"
          app:columnCount="3"
          app:orientation="horizontal"
          android:background="@drawable/ic_rounded_rectangle"
          &gt;
  
          &lt;ImageView
              android:id="@+id/rowImage"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              app:layout_column="0"
              app:layout_row="0"
              android:layout_marginTop="6dp"
              app:srcCompat="@drawable/ic_info_outline"
              app:layout_gravity="start|center_vertical"
              /&gt;
  
          &lt;TextView
              android:id="@+id/rowTitle"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="@android:color/white"
              app:layout_row="0"
              app:layout_column="1"
              android:textSize="20sp"
              app:layout_gravity="start"
              /&gt;
  
          &lt;TextView
              android:id="@+id/rowContent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="@android:color/white"
              app:layout_row="1"
              app:layout_column="1"
              android:textSize="20sp"
              app:layout_gravity="start"/&gt;
  
  
      &lt;/android.support.v7.widget.GridLayout&gt;
  
  
  
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p><strong>Edit</strong> This appears to be occuring mostly when debugging on hardware devices such as the LG G4 and emulators using API 19, Sometimes the gridlayout through an error or my viewpager throws an error..?</p>
  
  <p>I've included my main_activity.xml below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout 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/main_content"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context="com.lab1.ac01220.bloomv2.MainActivity"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingTop="@dimen/appbar_padding_top"
          android:theme="@style/AppTheme.AppBarOverlay"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:layout_weight="1"
              android:background="?attr/colorPrimary"
              app:layout_scrollFlags="scroll|enterAlways"
              android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
              app:title="@string/app_name"&gt;
  
          &lt;/android.support.v7.widget.Toolbar&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/tabs"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tabItem"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/tab_text_1" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tabItem2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/tab_text_2" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tabItem3"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/tab_text_3" /&gt;
  
          &lt;/android.support.design.widget.TabLayout&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/container"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"
          android:background="@drawable/ic_backing"/&gt;
  
  
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>