title: ViewModelProviders with Dagger 2, not able to grasp the concept
body: <p>I have a Retrofit Service like this</p>
  
  <pre><code>public interface BrandsService {
      @GET("listBrand")
      Call&lt;List&lt;Brand&gt;&gt; getBrands();
  }
  </code></pre>
  
  <p>Then I have a Repository to get data from an api like this</p>
  
  <pre><code>public class BrandsRepository {
      public static final String TAG = "BrandsRepository";
      MutableLiveData&lt;List&lt;Brand&gt;&gt; mutableLiveData;
      Retrofit retrofit;
  
      @Inject
      public BrandsRepository(Retrofit retrofit) {
          this.retrofit = retrofit;
      }
  
      public LiveData&lt;List&lt;Brand&gt;&gt; getListOfBrands() {
  //       Retrofit retrofit = ApiManager.getAdapter();
          final BrandsService brandsService = retrofit.create(BrandsService.class);
          Log.d(TAG, "getListOfBrands: 00000000000 "+retrofit);
  
          mutableLiveData = new MutableLiveData&lt;&gt;();
  
          Call&lt;List&lt;Brand&gt;&gt; retrofitCall = brandsService.getBrands();
          retrofitCall.enqueue(new Callback&lt;List&lt;Brand&gt;&gt;() {
              @Override
              public void onResponse(Call&lt;List&lt;Brand&gt;&gt; call, Response&lt;List&lt;Brand&gt;&gt; response) {
                  mutableLiveData.setValue(response.body());
              }
  
              @Override
              public void onFailure(Call&lt;List&lt;Brand&gt;&gt; call, Throwable t) {
                  t.printStackTrace();
              }
          });
          return mutableLiveData;
  
      }
  }
  </code></pre>
  
  <p>I am using constructor injection of Dagger2 by injecting Retrofit like that.
  Then I have a ViewModel like this</p>
  
  <pre><code>public class BrandsViewModel extends ViewModel{
      BrandsRepository brandsRepository;
      LiveData&lt;List&lt;Brand&gt;&gt; brandsLiveData;
      @Inject
      public BrandsViewModel(BrandsRepository brandsRepository) {
          this.brandsRepository = brandsRepository;
      }
  
      public void callService(){
         brandsLiveData = brandsRepository.getListOfBrands();
      }
  
      public LiveData&lt;List&lt;Brand&gt;&gt; getBrandsLiveData() {
          return brandsLiveData;
      }
  
  
  }
  </code></pre>
  
  <p>To inject Retrofit in BrandsRepository, I have to inject BrandsRepository like that.
  Then I have MainActivity like this</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      private static final String TAG = "MainActivity";
      @Inject
      BrandsViewModel brandsViewModel;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          ((MainApplication)getApplication()).getNetComponent().inject(this);
  
  //        BrandsViewModel brandsViewModel = ViewModelProviders.of(this).get(BrandsViewModel.class);
          brandsViewModel.callService();
  
          LiveData&lt;List&lt;Brand&gt;&gt; brandsLiveData = brandsViewModel.getBrandsLiveData();
          brandsLiveData.observe(this, new Observer&lt;List&lt;Brand&gt;&gt;() {
              @Override
              public void onChanged(@Nullable List&lt;Brand&gt; brands) {
                  Log.d(TAG, "onCreate: "+brands.get(0).getName());
              }
          });
  
  
      }
  }
  </code></pre>
  
  <p>The BrandsViewModel is injected using Dagger2 rather than ViewModelProviders. This is working fine but when I try to use ViewModelProviders by uncommenting it, dagger gives me the error which is obvious. The proper way of getting a ViewModel is by using ViewModelProviders but how will I accomplish this while injecting retrofit like that.</p>