Skip to content Skip to sidebar Skip to footer

Customscope May Not Reference Bindings With Different Scopes

I am new to dagger, I have defined my application component like this @Singleton @Component(modules = {ApplicationModule.class}) public interface ApplicationComponent { void in

Solution 1:

Any module's @Provides method may only have the same scope as the component they are part of. Read more here.

In your case LocationProviderModule is part of the LocationProviderComponent which is scoped with @LocationScope whereas the provides methods in that module uses the @Singleton scope. This is exactly what Dagger is complaining about:

LocationProviderComponent scoped with LocationScope may not reference bindings with different scopes

It is also pointing to where the problem is:

@Singleton@Provides FusedLocationProviderClient LocationProviderModule.provideFusedLocationProviderClient(android.content.Context)
@Singleton@Provides LocationRequest.module.LocationProviderModule.provideLocationRequest()

Instead of using @Singleton, you just need to use @LocationScope in the LocationProviderModule.

Post a Comment for "Customscope May Not Reference Bindings With Different Scopes"