title: 'Error inflating class Button' despite working before
body: <p>After implementing some buttons within my layout the following error appears within the logcat during app deployment:</p>
  
  <blockquote>
    <p>android.view.InflateException: Binary XML file line #37: Error inflating class Button</p>
  </blockquote>
  
  <p>I really don't understand why this is happening when it was working fine before.</p>
  
  <p><strong>XML</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingBottom="@dimen/activity_vertical_margin"
          android:paddingLeft="@dimen/activity_horizontal_margin"
          android:paddingRight="@dimen/activity_horizontal_margin"
          android:paddingTop="@dimen/activity_vertical_margin"&gt;
  
          &lt;TextView
              android:id="@+id/Information_textView"
              style="@android:style/TextAppearance.Large"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/information"
              android:textColor="@android:color/black" /&gt;
          &lt;TableLayout
              android:id="@+id/Information_tableLayout"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerHorizontal="true"
              android:layout_marginBottom="20dp"
              android:layout_below="@id/Information_textView"&gt;
  
              &lt;TableRow
                  android:id="@+id/tableRow0"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"&gt;
  
                  &lt;Button
                      android:id="@+id/Information_btnMale"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:drawableStart="@drawable/ic_male"
                      android:text="@string/male"
                      android:textColor="@android:color/white"
                      android:textSize="30sp"/&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:id="@+id/tableRow1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"&gt;
  
                  &lt;Button
                      android:id="@+id/Information_btnFemale"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:drawableStart="@drawable/female"
                      android:text="@string/female"
                      android:textColor="@android:color/white"
                      android:textSize="30sp"/&gt;
              &lt;/TableRow&gt;
          &lt;/TableLayout&gt;
      &lt;/RelativeLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p><strong>Java</strong></p>
  
  <pre><code>public class FragmentInformation extends android.support.v4.app.Fragment {
  
      public FragmentInformation() {
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  
          return inflater.inflate(R.layout.information, container, false);
      }
  
      @Override
      public void onActivityCreated(@Nullable Bundle savedInstanceState) {
          View v = getView();
          assert v != null;
  
  
          button0 = (Button) v.findViewById(R.id.Information_btnMale);
          button0.setOnClickListener(new View.OnClickListener()
          {
              @Override
              public void onClick(View v)
              {
                  HeaderDialog headerDialog = new HeaderDialog(getActivity());
                  headerDialog.setTitle(getResources().getString(R.string.male);                headerDialog.setMessage(getResources().getString(R.string.male_information);
                  headerDialog.setNegativeButton("OK", null);
              }
          });
  
  
          Button button1 = (Button) v.findViewById(R.id.Information_btnFemale);
          button1.setOnClickListener(new View.OnClickListener()
          {
              @Override
              public void onClick(View v)
              {
                  HeaderDialog headerDialog = new HeaderDialog(getActivity());
                  headerDialog.setTitle(getResources().getString(R.string.female);
                  headerDialog.setNegativeButton("OK", null);
              }
          });
  
  
          super.onActivityCreated(savedInstanceState);
      }
  }
  </code></pre>
  
  <p><strong>Logcat</strong></p>
  
  <pre><code>06-27 18:44:58.214 7756-7756/com.companyname.informationapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                      Process: com.companyname.informationapp, PID: 7756
                                                                                      android.view.InflateException: Binary XML file line #413: Error inflating class Button
                                                                                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                                                                                          at com.companyname.informationapp.FragmentInformation.onCreateView(FragmentInformation.java:30)
                                                                                          at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192)
                                                                                          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
                                                                                          at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
                                                                                          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
                                                                                          at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
                                                                                          at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
                                                                                          at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
                                                                                          at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
                                                                                          at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1984)
                                                                                          at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626)
                                                                                          at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
                                                                                          at android.support.v4.view.ViewPager.populate(ViewPager.java:1268)
                                                                                          at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:668)
                                                                                          at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:630)
                                                                                          at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:611)
  </code></pre>