title: Dagger2- Switching Dependencies for different flavours: Android Studio
body: <p>I am using Dagger 2 and would like to use it to inject different dependencies for different build flavours in Android Studio. </p>
  
  <pre><code>public class DemoApplication extends Application{
  
  AppComponent component;
  
      @Override
      public void onCreate() {
          super.onCreate();
  
   component = DaggerAppComponent.builder().module(new Module()).build();
      }
  }
  
  
  @Module
  public class Module {
  
      @Provides
      @Singleton
      public ClassA provideClassA(){
          return new ClassA();
      }
  }
  
  
  
  @Component (modules = {Module.class})
  public interface AppComponent {
  
      ClassA getClassA();
  
  }
  </code></pre>
  
  <p>Now lets say I want object of ClassA to be returned for prod flavour but an object of ClassB (which extends from ClassA) in the debug flavour. </p>