title: even a empty layout file is showing me inflate exception in android
body: <p><strong>The below is the layout file for activity main.The problem is  unable to start the activity since its showing some exception in the logcat.please help me to fix this.Initially when I had tried to display a grid view it showed this exception now also for a empty layout its showing the same exception I have no clue of what to do</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
  xmlns:tools=&quot;http://schemas.android.com/tools&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  tools:context=&quot;.activity.MainActivity&quot;&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  <p><strong>The below is my logcat</strong></p>
  <pre><code>2021-04-08 10:49:38.049 31158-31158/com.android.studymaterial E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.android.studymaterial, PID: 31158
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.studymaterial/com.android.studymaterial.activity.MainActivity}: android.view.InflateException: Binary XML file line #171 in com.android.studymaterial:layout/activity_main: row indices (start + span) mustn't exceed the row count. 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3780)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3956)
      at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2295)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loop(Looper.java:246)
      at android.app.ActivityThread.main(ActivityThread.java:8443)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
   Caused by: android.view.InflateException: Binary XML file line #171 in com.android.studymaterial:layout/activity_main: row indices (start + span) mustn't exceed the row count. 
   Caused by: java.lang.IllegalArgumentException: row indices (start + span) mustn't exceed the row count. 
      at android.widget.GridLayout.handleInvalidParams(GridLayout.java:855)
      at android.widget.GridLayout.checkLayoutParams(GridLayout.java:869)
      at android.widget.GridLayout.checkLayoutParams(GridLayout.java:886)
      at android.view.ViewGroup.addViewInner(ViewGroup.java:6073)
      at android.view.ViewGroup.addView(ViewGroup.java:5884)
      at android.view.ViewGroup.addView(ViewGroup.java:5856)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1125)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
      at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696)
      at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
      at com.android.studymaterial.activity.MainActivity.onCreate(MainActivity.kt:21)
      at android.app.Activity.performCreate(Activity.java:8183)
      at android.app.Activity.performCreate(Activity.java:8167)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3753)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3956)
      at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2295)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loop(Looper.java:246)
      at android.app.ActivityThread.main(ActivityThread.java:8443)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
  </code></pre>
  <hr />
  <pre><code>class MainActivity : AppCompatActivity() {
  lateinit var dept: Button
  lateinit var aboutapp: Button
  lateinit var announcements: Button
  lateinit var clgwebsite:Button
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
      dept = findViewById(R.id.btnDept)
      aboutapp = findViewById(R.id.btnAboutApp)
      announcements = findViewById(R.id.btnAnnouncement)
      clgwebsite=findViewById(R.id.btnClg)
      dept.setOnClickListener {
          Toast.makeText(this@MainActivity, &quot;clicked on dept&quot;, Toast.LENGTH_SHORT).show()
          val startact = Intent(this@MainActivity, department::class.java)
          startActivity(startact)
          finish()
      }
  
  
  
      aboutapp.setOnClickListener {
          Toast.makeText(this@MainActivity, &quot;clicked on about app&quot;, Toast.LENGTH_SHORT).show()
          val startact = Intent(this@MainActivity, Aboutapp::class.java)
          startActivity(startact)
          finish()
      }
      announcements.setOnClickListener {
          Toast.makeText(this@MainActivity, &quot;clicked on announcements&quot;, Toast.LENGTH_SHORT).show()
          val startact = Intent(this@MainActivity, Announcement::class.java)
          startActivity(startact)
          finish()
  
      }
    }
  }
  </code></pre>