title: setContentView(R.layout.activity_main) causes app to crash
body: <p>Making a calculator program for android and I have an xml file that has all the buttons nesesary to write the program. It shows up in the design part of android studio, but when I'm trying to run my app on an android phone (not emulator; it runs too slow on my pc) it just causes it to crash. Not sure why either.</p>
  
  <p>This is my xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout&gt;
      &lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:id="@+id/activity_main"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:columnCount="4"
          android:rowCount="7"
          tools:context="com.example.pvtboromeo.calc.MainActivity"&gt;
  
          &lt;EditText
              android:id="@+id/editText"
              android:background="@android:color/black"
              android:textColor="#FFFFFF"
              android:layout_row="0"
              android:layout_column="0"
              android:layout_columnSpan="4"
              android:layout_rowSpan="2"
              android:layout_rowWeight="2"
              android:layout_columnWeight="4"
              android:enabled="false"
              android:gravity="bottom|right"
              android:paddingRight="15sp"
              android:paddingBottom="15sp"
              android:textAlignment="gravity"
              android:textSize="40sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonC"
              android:layout_column="0"
              android:layout_columnWeight="1"
              android:layout_row="2"
              android:layout_rowWeight="1"
              android:background="@drawable/button_border"
              android:text="C"
              android:textSize="20sp" /&gt;
  
          &lt;Button
              android:id="@+id/buttonNegative"
              android:layout_row="2"
              android:layout_column="1"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="+/-"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonPercent"
              android:layout_row="2"
              android:layout_column="2"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="%"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonDivide"
              android:layout_row="2"
              android:layout_column="3"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border2"
              android:text="/"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonSeven"
              android:layout_row="3"
              android:layout_column="0"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="7"
              android:textSize="20sp" /&gt;
  
          &lt;Button
              android:id="@+id/buttonEight"
              android:layout_row="3"
              android:layout_column="1"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="8"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonNine"
              android:layout_row="3"
              android:layout_column="2"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="9"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonMultiply"
              android:layout_row="3"
              android:layout_column="3"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border2"
              android:text="X"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonFour"
              android:layout_row="4"
              android:layout_column="0"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="4"
              android:textSize="20sp" /&gt;
  
          &lt;Button
              android:id="@+id/buttonFive"
              android:layout_row="4"
              android:layout_column="1"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="5"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonSix"
              android:layout_row="4"
              android:layout_column="2"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="6"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonSubtract"
              android:layout_row="4"
              android:layout_column="3"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border2"
              android:text="-"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonOne"
              android:layout_row="5"
              android:layout_column="0"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="1"
              android:textSize="20sp" /&gt;
  
          &lt;Button
              android:id="@+id/buttonTwo"
              android:layout_row="5"
              android:layout_column="1"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="2"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonThree"
              android:layout_row="5"
              android:layout_column="2"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="3"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonAdd"
              android:layout_row="5"
              android:layout_column="3"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border2"
              android:text="+"
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonZero"
              android:layout_column="0"
              android:layout_columnSpan="2"
              android:layout_columnWeight="2"
              android:layout_row="6"
              android:layout_rowWeight="1"
              android:background="@drawable/button_border"
              android:text="0"
              android:textSize="20sp" /&gt;
  
          &lt;Button
              android:id="@+id/buttonDecimal"
              android:layout_row="6"
              android:layout_column="2"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border"
              android:text="."
              android:textSize="20sp"/&gt;
  
          &lt;Button
              android:id="@+id/buttonEquals"
              android:layout_row="6"
              android:layout_column="3"
              android:layout_rowWeight="1"
              android:layout_columnWeight="1"
              android:background="@drawable/button_border2"
              android:text="="
              android:textSize="20sp"/&gt;
  
      &lt;/GridLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>And this is my java file</p>
  
  <pre><code>package com.example.pvtboromeo.calc;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  }
  </code></pre>
  
  <p>Without the setContentView code, my app runs but nothing is displayed (obviously) but now my app crashes when I try to run it. The error just says 'Unfortunatly, Calc+ has stopped.'</p>
  
  <p>I'm new to android development. Am I missing something? All my syntax seems to be good.</p>
  
  <p><strong>Note:</strong> I also checked if android.R was imported instead of my package R, but it's not there...</p>
  
  <p><strong>Edit:</strong> So I've just messed around with a test project and found out that it's the GridLayout that's causing the app to crash. I'm running using android 5.1.1 (Lolipop) not sure if that helps or not. I believe it's api 22. Is there a way to fix this?</p>