Monday, 1 April 2019

Warning when using dagger: "@Component.Builder has setters for modules or components that aren't required"

I'm trying to implement new features using Dagger.

My code

object File {

    lateinit var component: Component

    fun initialize(@NotNull context: Context) {


        component = DaggerFile_Component
            .builder()
            .context(context)
            .build()

    }

    @dagger.Component(modules = [Module::class])

    interface Component {
        fun uploadFile(): UploadFile
        fun awsService(): AwsService
        fun glideLoad(): GlideLoad

        @dagger.Component.Builder
        interface Builder {
            @BindsInstance
            fun context(context: Context): Builder

            fun build(): Component
        }

    }


    @dagger.Module
    internal abstract class Module {

        @Binds
        internal abstract fun bindUploadFile(uploadFileImp: UploadFileImp): UploadFile

        @Binds
        internal abstract fun bindAwsService(awsServiceImp: AwsServiceImp): AwsService

        @Binds
        internal abstract fun bindGlideLoad(glideLoadImp: GlideLoadImp): GlideLoad
    }
}

While building the project I get:

@Component.Builder has setters for modules or components that aren't required

Any help is really appreciated.



from Warning when using dagger: "@Component.Builder has setters for modules or components that aren't required"

No comments:

Post a Comment