title: Dagger 2 LocalDataSource cannot be provided without @Provides annotated method
body: <p>I'm trying to follow the same example as in <a href="https://github.com/googlesamples/android-architecture/tree/todo-mvp-dagger" rel="nofollow noreferrer">here</a> by creating a Repository pattern with DI.
  The problem is that I get the following error:</p>
  
  <blockquote>
    <p>"Error:(16, 20) error: @mvp.model.di.scope.Local
    mvp.model.repository.local.GameLocalDataSource cannot be provided
    without an @Provides-annotated method. @mvp.model.di.scope.Local
    mvp.model.repository.local.GameLocalDataSource is injected at
    mvp.model.repository.GameRepository.(gameLocalDataSource, …)
    mvp.model.repository.GameRepository is provided at
    mvp.model.di.component.RepositoryComponent.getGameRepository()"</p>
  </blockquote>
  
  <p>Here's the code related to the app:</p>
  
  <pre><code>public class GameApplication extends Application {
  private RepositoryComponent repositoryComponent;
  
  @Override
  public void onCreate() {
      super.onCreate();
      if (LeakCanary.isInAnalyzerProcess(this)) {
          // This process is dedicated to LeakCanary for heap analysis.
          // You should not init your app in this process.
          return;
      }
      LeakCanary.install(this);
      // Normal app init code...
      repositoryComponent = DaggerRepositoryComponent.builder()
              .applicationModule(new ApplicationModule((getApplicationContext())))
              .build();
  }
  
  public RepositoryComponent getRepositoryComponent() {
      return repositoryComponent;
  }
  }
  </code></pre>
  
  <p>This is my <code>RepositoryComponent</code>:</p>
  
  <pre><code>@Singleton
  @Component(modules = {RepositoryModule.class, ApplicationModule.class})
  public interface RepositoryComponent {
      GameRepository getGameRepository();
  }
  </code></pre>
  
  <p>Here's the <code>RepositoryModule</code>:</p>
  
  <pre><code>    @Module
  public class RepositoryModule {
      @Singleton
      @Provides
      @Local
      GameDataSource provideLocalDataSource(Context context) {
          return new GameLocalDataSource(context);
      }
  
      @Singleton
      @Provides
      @Remote
      GameDataSource provideRemoteDataSource() {
          return new GameRemoteDataSource();
      }
  }
  </code></pre>
  
  <p>And finally, the <code>ApplicationModule</code>:</p>
  
  <pre><code>    @Module
  public final class ApplicationModule {
      private Context context;
  
      public ApplicationModule(Context context) {
          this.context = context;
      }
  
      @Provides
      Context providesContext() {
          return context;
      }
  }
  </code></pre>
  
  <p>Here's most of my <code>GameRepository</code> class:</p>
  
  <pre><code>@Singleton
  public class GameRepository implements GameDataSource {
      private GameDataSource remoteDataSource;
      private GameDataSource localDataSource;
  
      @Inject
      public GameRepository(@Local GameLocalDataSource gameLocalDataSource, @Remote GameRemoteDataSource gameRemoteDataSource) {
          remoteDataSource = gameRemoteDataSource;
          localDataSource = gameLocalDataSource;
      }
  </code></pre>
  
  <p>Also, as in the mentioned example, I created a couple of scopes, <code>@Local</code> and <code>@Remote</code> since my two data sources have the same type and Dagger needs to differentiate them.</p>
  
  <pre><code>@Qualifier
  @Documented
  @Retention(RetentionPolicy.RUNTIME)
  public @interface Local {
  
  }
  </code></pre>
  
  <p>The rest of the code I have related to dagger, is just the <code>@Inject</code> in the constructors where I want to inject my dependencies.
  Also, the <code>DaggerRepositoryComponent</code> is never generated in the <code>GameApplication</code> class.</p>
  
  <p>Thanks a lot for the help in advance!</p>