title: Dagger 2 injection not working
body: <p>The module that proides singletons of Gson, Retrofit and OkHttpClient </p>
  
  <pre><code>@Module
  public class MyModule {
  
      @Provides
      @Singleton
      Gson provideGson() {
          GsonBuilder gsonBuilder = new GsonBuilder();
          return gsonBuilder.create();
      }
  
      @Provides
      @Singleton
      OkHttpClient provideOkHttpClient() {
          OkHttpClient client = new OkHttpClient();
          return client;
      }
  
      @Provides
      @Singleton
      Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) {
          Retrofit retrofit = new Retrofit.Builder()
                  .addConverterFactory(GsonConverterFactory.create(gson))
                  .baseUrl(BuildConfig.SERVER_BASE_URL)
                  .client(okHttpClient)
                  .build();
          return retrofit;
      }
  }
  </code></pre>
  
  <p>The component that allows injecting the Singletons into activity and fragments</p>
  
  <pre><code>@Singleton
  @Component(modules={MyModule.class})
  public interface MyComponent {
  
      void inject(Activity activity);
      void inject(Fragment fragment);
      void inject(Application application);
  }
  </code></pre>
  
  <p>The main application class that builds the component</p>
  
  <pre><code>public class MyApp extends Application{
  
  
      private MyComponent component;
  
      @Inject
      Retrofit retrofit;
  
      @Override
      public void onCreate() {
          super.onCreate();
          component= DaggerMyComponent.builder()
                  .myModule(new MyModule()).build();
          getComponent().inject(this); // inject retrofit here
      }
  
      public MyComponent getComponent() {
          return component;
      }
  }
  </code></pre>
  
  <p>This is the Fragment where I am trying to inject Retrofit.</p>
  
  <pre><code>public class MyFragment extends Fragment {
  
      @Inject
      Retrofit retrofit;
  
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                               @Nullable Bundle savedInstanceState) {
          ((MyApp)getActivity().getApplication()).getComponent().inject(this);
        ....
  
      }
  }
  </code></pre>
  
  <p>In both MyApp and MyFragment the retrofit instance is null.</p>