Dagger 2: @Component.Builder is missing setters for required modules or components: [appi.example.com.dagger.AppModule]`

前端 未结 3 896
失恋的感觉
失恋的感觉 2020-12-13 00:00

I\'m configuring the new Dagger Android module but I got this error Here\'s my Component:

@AppScope
@Component(modules = {AppModule.class, NetModule.class})
         


        
3条回答
  •  春和景丽
    2020-12-13 00:45

    In my case I was using an object Module, so I had to annotate provider method with @JvmStatic

    @Module
    object GsonModule {
    
        @JvmStatic
        @Singleton
        @Provides
        fun provideGson() = Gson()
    
    }
    

提交回复
热议问题