title: Can't fix error: Cannot find symbol class ActivityMainBindingImpl
body: <p>I've got following error while trying to build prject with MVVM and data binding. I've searched through everything I could find here on StackOverflow, or common mistakes on the internet, but nothing worked for my case. <br>
  The only message I receive is this error. It looks like this in <code>buildOutput</code>:<br><br>
  <a href="https://i.stack.imgur.com/QQAJ4.png%3Cbr%3E%3Cbr%3E" rel="noreferrer"><img src="https://i.stack.imgur.com/QQAJ4.png%3Cbr%3E%3Cbr%3E" alt="enter image description here" /></a></p>
  <p>I've had my packages named with capital letters and I've found here that this might be the cause because compiler treat them as names of classes, so I've changed them all to start with small letters, but that haven't helped.<br><br>
  I've created <code>ViewModelFactory</code> for creating my <code>ViewModel</code> inside <code>Activity</code> so I could send additional parameters with constructor using factory, so I've tried to remove it and use no parameters and create instance without using factory for this purpose, but still I havn't got any results (same error)<br><br>
  I was chaning both <code>build.gradle</code>'s in different ways but result was always the same.<br>
  Finally I've deleted data binding and variable from XML, then I was able to run the app (with other errors, but I would be probably able to deal with those by myself) but I want to leave it as it is and just deal with my error. <br><br>
  I am not experienced with MVVM and data binding so it can be just a stupid mistake, but it is hard to find it if I don't know where I should look for it.<br><br>
  Here I post most important codes, if you need more then let me know:<br><br>
  <strong>build.grale(app)</strong></p>
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-android-extensions'
  apply plugin: 'kotlin-kapt'
  
  android {
      compileSdkVersion 30
      buildToolsVersion &quot;29.0.3&quot;
  
      defaultConfig {
          applicationId &quot;com.example.rickmorty&quot;
          minSdkVersion 24
          targetSdkVersion 30
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  
      buildFeatures{
          dataBinding = true
          viewBinding = true
      }
  }
  
  dependencies {
      implementation fileTree(dir: &quot;libs&quot;, include: [&quot;*.jar&quot;])
      implementation &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot;
      implementation 'androidx.core:core-ktx:1.3.1'
      implementation 'androidx.appcompat:appcompat:1.1.0'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      implementation 'com.google.android.material:material:1.3.0-alpha02'
      implementation &quot;android.arch.lifecycle:extensions:1.1.1&quot;
      implementation &quot;androidx.cardview:cardview:1.0.0&quot;
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  
      implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
      implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
  
      implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
      implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
  
      implementation 'com.github.bumptech.glide:glide:4.6.1'
      kapt 'com.github.bumptech.glide:compiler:4.4.0'
  }
  </code></pre>
  <p>**build.gradle(project)</p>
  <pre><code>buildscript {
      ext.kotlin_version = &quot;1.3.72&quot;
      repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath &quot;com.android.tools.build:gradle:4.0.0&quot;
          classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;
          
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  <p><strong>MainActivity</strong></p>
  <pre><code>class MainActivity : AppCompatActivity() {
  
      lateinit var mainViewModel: MainViewModel
      lateinit var mAdapter: CharactersAdapter
      lateinit var api: CharacterAPI
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val retrofit = RetrofitClient.instance
          api = retrofit.create(CharacterAPI::class.java)
          setupViewModel()
          setupRecycler()
  
          mainViewModel.getData().observe(this,
              Observer&lt;List&lt;Results&gt;&gt; { t -&gt;
                  mAdapter = CharactersAdapter(this@MainActivity, t!!)
                  rvCharacters.adapter = mAdapter
              })
      }
  
      fun setupRecycler() {
          val lManager = LinearLayoutManager(this@MainActivity)
          rvCharacters.apply {
              setHasFixedSize(true)
              layoutManager = lManager
          }
          rvCharacters.addOnScrollListener(object : RecyclerView.OnScrollListener() {
              override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
                  super.onScrolled(recyclerView, dx, dy)
                  val visibleItems = lManager.childCount
                  val totalItems = lManager.itemCount
                  val firstVisible = lManager.findFirstVisibleItemPosition()
                  if (dy &gt; 0) {
                      if (!mainViewModel.isLoading.value!! &amp;&amp; (visibleItems + firstVisible) &gt;= totalItems) {
                          mainViewModel.scrolledNext()
                      }
                  } else {
                      if (!mainViewModel.isLoading.value!! &amp;&amp; (totalItems - visibleItems) &lt;= 0) {
                          mainViewModel.scrolledPrev()
                      }
                  }
              }
  
          })
      }
  
      fun setupViewModel() {
          mainViewModel = ViewModelProviders.of(this, MainViewModelFactory(application, api))
              .get(MainViewModel::class.java)
          DataBindingUtil.setContentView&lt;ActivityMainBinding&gt;(
              this, R.layout.activity_main
          ).apply {
              lifecycleOwner = this@MainActivity
              viewmodel = mainViewModel
          }
      }
  }
  </code></pre>
  <p><strong>activity_main.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;layout
      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;&gt;
      &lt;data&gt;
          &lt;variable
              name=&quot;viewmodel&quot;
              type=&quot;com.example.rickmorty.ViewModel.MainViewModel&quot;/&gt;
      &lt;/data&gt;
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          tools:context=&quot;.MainActivity&quot;&gt;
  
          &lt;RelativeLayout
              android:id=&quot;@+id/rlPageTitleHolder&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;0dp&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;
              app:layout_constraintHeight_percent=&quot;0.1&quot;&gt;
  
              &lt;TextView
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:textSize=&quot;24sp&quot;
                  android:layout_centerInParent=&quot;true&quot;
                  android:text=&quot;@{() -&gt; viewmodel.pageNumber}&quot;/&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;androidx.recyclerview.widget.RecyclerView
              android:id=&quot;@+id/rvCharacters&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;0dp&quot;
              app:layout_constraintTop_toBottomOf=&quot;@id/rlPageTitleHolder&quot;
              app:layout_constraintHeight_percent=&quot;0.9&quot;/&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  <p>As I wrote earlier, after removing <code>variable</code> from XML and binding from <code>MainActivity</code> error disappears.
  I know it is a lot of code, so if something is redundant just let me know. There is factory class still missing, but I will post it if it's necessary. Also <code>MainRepo</code> is one I haven't attached here, but it's quite long, but I can post it all if you're gonna need it.</p>