dagger error: Duplicate bindings for java.lang.String -
I'm new to the knife and I'm studding small app for Android. I am trying to use retrofit for REST requests at http and https for two servers (dev and prod).
@ dagger.Module (override = true, library = true, full = false) public class DebugApiModule {private static final String SRV = "dev.mysrv: I debug flavor where the module Is .com "; Private static final string HTTP = "http: //"; Private static final string HTTPS = "https: //"; Public Fixed Last String API_URL = HTTP + SRV; Public Static Last String API_URL_SECURE = HTTPS + SRV; Provide @Provides @ Sittington @ API String (AP) {return API_URL; } @Provides @Singleton @ApiSecureEnter APIApric () {Return API_URL_SECURE; }}
Here I ordered two wire'm annotations used to separate, but I get the error:
error (23, 50) error: binding java.lang.String duplicate override module (s) - can not override an override: com.myapp.common.api.DebugApiModule.provideApi () com.myapp.common.api.DebugApiModule. ProvideApiSecure ()
What's wrong with this code?
two @Api
and @ApiSecure
annotation To use the dagger as a factor, you need to annotate with the javax.inject.Qualifier
.
@ qualifiers Risetn (Rutmum) public @ Intefes API {}
Comments
Post a Comment