title: Dagger 2 and Android Databinding Adapter: cannot be provided without an @Inject or @Provides
body: <p>I'm using Android's Databinding library and Dagger 2. I wanted to make use of a DatabingAdapter in displaying my images in the RecyclerView. I have my Picasso instance created using Dagger and I have to inject it inside the DatabindingAdapter that I created. I followed this tutorial <a href="https://philio.me/using-android-data-binding-adapters-with-dagger-2/" rel="nofollow noreferrer">here</a> and I'm getting the error that Picasso cannot be provided without @Inject or @Provides annotated method. Here's my code (classes are simplified to focus more on this issue, I got Picasso already working before).</p>
  
  <h3>AppModule.java</h3>
  
  <pre><code>@Module(includes = {AndroidInjectionModule.class, NetworkModule.class, ViewModelModule.class})
  public class AppModule {
  
      @Provides
      @AppScope
      Picasso picasso(App app, OkHttp3Downloader okHttp3Downloader) {
          return new Picasso.Builder(app.getApplicationContext())
                  .downloader(okHttp3Downloader)
                  .indicatorsEnabled(true)
                  .build();
      }
  }
  </code></pre>
  
  <h3>BindingModule.java</h3>
  
  <pre><code>@Module
  public class BindingModule {
      @BindingScope
      @Provides
      ImageBindingAdapter provideImageBindingAdapter(Picasso picasso) {
          return new ImageBindingAdapter(picasso);
      }
  }
  </code></pre>
  
  <h3>BindingComponent.java</h3>
  
  <pre><code>@BindingScope
  @Component(dependencies = AppComponent.class, modules = BindingModule.class)
  public interface BindingComponent extends androidx.databinding.DataBindingComponent {
  }
  </code></pre>
  
  <h3>AppComponent.java</h3>
  
  <pre><code>@AppScope
  @Component(modules = {AppModule.class, AndroidSupportInjectionModule.class, ActivityBuildersModule.class})
  public interface AppComponent {
  
      void inject(App app);
  
      @Component.Builder
      interface Builder {
          @BindsInstance
          Builder application(App application);
  
          AppComponent build();
      }
  }
  </code></pre>
  
  <h3>ImageBindingAdapter.java</h3>
  
  <pre><code>public class ImageBindingAdapter {
  
      private final Picasso picasso;
  
      public ImageBindingAdapter(Picasso picasso) {
          this.picasso = picasso;
      }
  
      @BindingAdapter(value = "url")
      public void loadImageUrl(ImageView imageView, String url) {
          if (url != null &amp;&amp; !url.trim().isEmpty())
              picasso.load(Constants.ENDPOINT + url).into(imageView);
      }
  }
  </code></pre>
  
  <p>And here's what the error is.</p>
  
  <pre><code>error: [Dagger/MissingBinding] com.squareup.picasso.Picasso cannot be provided without an @Inject constructor or an @Provides-annotated method.
  com.squareup.picasso.Picasso is injected at
  com.ralphevmanzano.themoviedb.di.modules.BindingModule.provideImageBindingAdapter(picasso)
  com.ralphevmanzano.themoviedb.databinding.ImageBindingAdapter is provided at
  androidx.databinding.DataBindingComponent.getImageBindingAdapter()
  </code></pre>
  
  <p>Any help is much appreciated.</p>