"Repeats modules with scoped bindings or declarations .. with scopes: @javax.inject.Singleton" Dagger 2

  android, dagger, dagger-hilt, dependency-injection, java

I’m trying out the Hilt DI in my test project. I’ve the following module that’s installed in SingletonComponent which in terms of Android is applicationComponent. However when I try to scope the provide method with @Singleton, I get the following error.

MyApplication_HiltComponents.ViewModelC repeats modules with scoped bindings or declarations:
  public abstract static class SingletonC implements MyApplication_GeneratedInjector,
    - com.test.catalogue.presentation.application.MyApplication_HiltComponents.SingletonC also includes:
      - com.test.catalogue.di.modules.RetrofitModule with scopes: @javax.inject.Singleton

Following is my module declaration.


@Module(includes = {OKHttpModule.class})
public class RetrofitModule {

    public MyApi providesAPI(Retrofit retrofit) {
        return retrofit.create(MyApi.class);

    public Retrofit providesRetrofit(OkHttpClient okHttpClient, GsonConverterFactory gsonConverterFactory, LiveDataAdapterFactory liveDataAdapterFactory) {
        return new Retrofit.Builder()

    public GsonConverterFactory providesGsonConverterFactory() {
        return GsonConverterFactory.create();

    public LiveDataAdapterFactory providesCallToLiveDataAdapterFactory() {
        return new LiveDataAdapterFactory();


ext.hilt_version = '2.31.2-alpha'

implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-compiler:$hilt_version" 

OkHttpModule also has @InstallIn(SingletonComponent.class) but doesn’t have @Singleton scoped provides() yet since I couldn’t add them because I get the same error as mentioned above.

How can I fix this? What am I doing wrong here? Am I missing something?

Source: Android Questions