title: Android Kotlin - viewBinding Type mismatch: inferred type is DrawerLayout but ConstraintLayout was expected
body: <p>I'm trying to get viewBinding to work.</p>
  <p>This is the code:</p>
  <pre><code>private lateinit var binding: ActivityMainBinding
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      binding = ActivityMainBinding.inflate(layoutInflater)
      val view: ConstraintLayout = binding.root
      setContentView(view)
  }
  </code></pre>
  <p>I manually declared the type <code>ConstraintLayout</code> because it's what I'm using for that activity called <code>AskProfileImage</code>:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout 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;
      android:background=&quot;#303030&quot;
      tools:context=&quot;.AskProfileImage&quot;&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/imageView97545&quot;
          android:layout_width=&quot;108dp&quot;
          android:layout_height=&quot;64dp&quot;
          android:layout_marginTop=&quot;8dp&quot;
          android:background=&quot;#00FFFFFF&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:srcCompat=&quot;@drawable/logo2&quot; /&gt;
  </code></pre>
  <p>But I'm getting the error</p>
  <pre><code>Type mismatch: inferred type is DrawerLayout but ConstraintLayout was expected
  </code></pre>
  <p>on</p>
  <pre><code>binding.root
  </code></pre>
  <p>how to fix this?</p>