ursus
12/20/2018, 12:43 AMapi project(:core)
the solution here? Id like to avoid that
or, rather, should I remove `@Provides`˛from fun okhttp()
, fun retrofit()
methods and have only my final ApiClient
be @Provides
?
which however then muddies up the params of the dependency which are before more explicit like:
@Singleton @Provides fun apiClient(api: Api): ApiClient {
(edited)
to
@Singleton @Provides fun apiClient(context: Context): ApiClient {
val okHttpClient = okHttpClient(context)
val moshi = moshi()
val retrofit = retrofit(okHttpClient, moshi)
val api = api(retrofit)
return ApiClient(api)
}
efemoney
12/20/2018, 7:44 AMapi
configuration is what you need but not in your :app module. You’ll need it for the dependencies in question in your :core module. For example your :core build script will look like
implementation project(:dependency-not-exposed-to-app)
api "okhttp"
api "retrofit"
:app can then consume :core as an implementation dependency
implementation project(:core)