I am new to dagger, I have defined my application component like this
@Singleton
@Component(modules = {ApplicationModule.class})
public interface Application
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
.