title: Android RecyclerView Adapter DataBinding - cannot find symbol {layout}BindingImpl
body: <p>I have a Fragment that displays a list of cities with weather informations. I am using a RecyclerView and I am trying to implement the Data Binding Library in my RecyclerView Adapter but for some reason I get this compile error : </p>
  
  <pre><code>&gt; error: cannot find symbol import 
           com.example.zach.weatherapp.databinding.CityListItemBindingImpl;
  &gt;                                               ^   
  &gt; symbol:   class CityListItemBindingImpl   
  &gt; location: package com.example.zach.weatherapp.databinding
  </code></pre>
  
  <p>It's an auto generated class so i really don't know where the error is. I had the same error previously for other layouts when there was someting wrong in the xml file but here it seems fine.</p>
  
  <p>ForecastAdapter.kt</p>
  
  <pre><code>package com.example.zach.weatherapp.Adapter
  
  import ...
  
  class ForecastAdapter(var myDataset: List&lt;City&gt;) :
      RecyclerView.Adapter&lt;ForecastAdapter.ForecastViewHolder&gt;() {
  
      var context:Context?=null
      // Provide a reference to the views for each data item
      // Complex data items may need more than one view per item, and
      // you provide access to all the views for a data item in a view holder.
      class ForecastViewHolder(var binding: CityListItemBinding) : RecyclerView.ViewHolder(binding.root){
          fun bind(city: City){
              binding.city = city
          }
      }
  
  
      // Create new views (invoked by the layout manager)
      override fun onCreateViewHolder(parent: ViewGroup,
                                      viewType: Int): ForecastAdapter.ForecastViewHolder {
  
          context = parent.context
          val layoutIdForListItem = R.layout.city_list_item
          val inflater = LayoutInflater.from(context)
          val shouldAttachToParentImmediately = false
  
          val binding = DataBindingUtil.inflate&lt;CityListItemBinding&gt;(inflater,layoutIdForListItem,parent,shouldAttachToParentImmediately)
          //val view = inflater.inflate(layoutIdForListItem, parent, shouldAttachToParentImmediately)
  
          return ForecastViewHolder(binding)
      }
  
      // Replace the contents of a view (invoked by the layout manager)
      override fun onBindViewHolder(holder: ForecastViewHolder, position: Int) {
  
          val city = myDataset[position]
          holder.bind(city)
  
          Glide.with(context)
              .load("http://openweathermap.org/img/w/${city.weather[0].icon}.png")
              .into(holder.binding.forceastImageView)
          holder.binding.container.setOnClickListener{ view: View -&gt;
              Timber.d("Clicked on city %s",city.name)
              Navigation.findNavController(view).navigate(ListFragmentDirections.actionListFragmentToForecastDetailsFragment(city.id))}
      }
  
      // Return the size of your dataset (invoked by the layout manager)
      override fun getItemCount() = myDataset.size
  }
  </code></pre>
  
  <p>city_list_item.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;data&gt;
          &lt;variable name="city" type="com.example.zach.weatherapp.data.City"/&gt;
      &lt;/data&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
         android:orientation="horizontal"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:id="@+id/container"&gt;
  
          &lt;TextView
                  tools:text="Caen"
                  android:text="@{city.name}"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content" android:id="@+id/city_name_textview"
                  app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="16dp"
                  android:layout_marginTop="16dp" app:layout_constraintTop_toTopOf="parent"
                  android:fontFamily="@font/roboto_light" android:textSize="22sp" android:textStyle="bold"
                  android:maxLines="1" android:ellipsize="end"/&gt;
          &lt;TextView
                  tools:text="Sunny"
                  android:text="@{city.weather[0].description}"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:id="@+id/city_forecast_textview" app:layout_constraintStart_toStartOf="parent"
                  android:layout_marginStart="16dp"
                  app:layout_constraintTop_toBottomOf="@+id/city_name_textview" android:fontFamily="@font/roboto_light"
                  android:layout_marginBottom="16dp" app:layout_constraintBottom_toBottomOf="parent"/&gt;
          &lt;ImageView
                  android:layout_width="48dp"
                  android:layout_height="48dp" app:srcCompat="@drawable/sunny"
                  android:id="@+id/forceast_imageView" android:layout_marginTop="8dp"
                  app:layout_constraintTop_toTopOf="parent" android:layout_marginBottom="8dp"
                  app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintVertical_bias="0.562"
                  android:layout_marginEnd="32dp" app:layout_constraintEnd_toStartOf="@+id/temperatures_layout"/&gt;
          &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content" android:id="@+id/temperatures_layout"
                  app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="16dp" android:layout_marginBottom="8dp"
                  app:layout_constraintBottom_toBottomOf="parent" android:layout_marginTop="8dp"
                  app:layout_constraintTop_toTopOf="parent"&gt;
              &lt;TextView
                      tools:text="15°"
                      android:text="@{city.main.temp_max}"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content" android:id="@+id/max_temperature_textview"
                      android:fontFamily="@font/roboto_light"
                      tools:layout_editor_absoluteY="17dp" tools:layout_editor_absoluteX="313dp"/&gt;
              &lt;TextView
                      tools:text="9°"
                      android:text="@{city.main.temp_min}"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:id="@+id/min_temperature_textview"
                      android:fontFamily="@font/roboto_light" tools:layout_editor_absoluteY="45dp"
                      tools:layout_editor_absoluteX="321dp" android:layout_gravity="right"/&gt;
          &lt;/LinearLayout&gt;
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>It might just be an Android Studio error because the xml file seems fine. </p>
  
  <p><strong>UPDATE :</strong>
  Error seems to come from Xml. I removed the <code>android:text="@{city.xxx}"</code> in my xml layout and instead updated my textViews manually in my ViewHolder bind method like so : </p>
  
  <pre><code>fun bind(boundCity: City){
          with(binding){
              cityNameTextview.text = boundCity.name
              cityForecastTextview.text = boundCity.weather[0].description
              maxTemperatureTextview.text = "${boundCity.main.temp_max}°"
              minTemperatureTextview.text = "${boundCity.main.temp_min}°"
  
              Glide.with(root.context)
                  .load("http://openweathermap.org/img/w/${boundCity.weather[0].icon}.png")
                  .into(forceastImageView)
  
              container.setOnClickListener{ view: View -&gt;
                  Timber.d("Clicked on city %s",boundCity.name)
                  Navigation.findNavController(view).navigate(ListFragmentDirections.actionListFragmentToForecastDetailsFragment(boundCity.id))}
          }
      }
  </code></pre>
  
  <p>And I no longer get the error. The error comes whenever I add <code>android:text="@{city.xx}"</code> in my textviews and bind the city variable in the bind method. I still don't know why though....</p>