ghedeon
01/30/2019, 12:14 PMapp
gradle module depends on feature
gradle module. When I define my featureModule
in the feature
, it fails to generate provide methods, but it works if I move it to the app
.ghedeon
02/01/2019, 12:54 AMapp
gradle module depends on feature
library module). The general advice that I often see: if you don't want to get lost in dagger — don't bring Components to the library modules. It's easier if you just connect all your dagger modules from libraries in the final app
module under one Component.
That works, up to a point. Let say you need to do some manual injection in one of the libraries. But Component is in the app
, so you don't have a direct reference. What are my options here?kingsley.gomes
03/15/2019, 3:21 PMe: error: compiler message file broken: key=compiler.err.Processor: org.jetbrains.kotlin.kapt3.base.ProcessorWrapper@16547060 arguments={0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}
e: error: cannot access Operations
class file for com.Operations not found
Consult the following stack trace for details.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.Operations not found
:app:kaptDebugKotlin FAILED
juliocbcotta
03/21/2019, 4:04 AM@IntoSet
? Like... @IntoSet fun provideFooBar(): Foo<Bar> ...
and collect it using something like val mySet: Set<@JvmSuppressWildcards Foo<Bar>>
?amrelmasry
04/08/2019, 10:58 AM// build.gradle.kts
plugins {
id("kotlin-kapt")
}
dependencies {
// ...
kapt(Libs.DAGGER_PROCESSOR) // this works fine
kaptAndroidTest(Libs.DAGGER_PROCESSOR) // this doesn't work
}
class Test {
@Module
class DummyModule
@Component(modules = [DummyModule::class])
interface DummyComponent {
}
}
william
04/09/2019, 11:36 AM@Inject
field that is never used just so my object gets created - this seems odd thoughKavin
04/13/2019, 1:39 PMKavin
06/18/2019, 6:03 AMlateinit property has not been initialized error
. I believe I have done everything but not sure what’s missing!Kavin
06/18/2019, 6:07 AMgumil
07/29/2019, 12:12 PMJacob Richards
09/16/2019, 6:05 AMjw
09/24/2019, 2:57 PM@Whatever
instead of @field:Whatever
)
- Understand @Module
on object
does not require a module instance.
We have a few more in the pipeline, but if you have any ideas of small ergonomic improvements like this please file an issue on GitHub.ghedeon
09/25/2019, 6:59 AMritesh
10/05/2019, 7:18 PMget()
overriden method in the class.
As all classes required for the DI graph are created at compile time. I was wondering when the actual creation of the object happens, when get()
is actually called. Does it gets called and object is created when it's requested through @inject
or happens at compile time and just returns when @inject
gets called.arekolek
10/25/2019, 4:18 PMfurkan.akdemir
10/27/2019, 9:17 PMjw
10/27/2019, 9:18 PMPaul Woitaschek
11/05/2019, 8:46 AMDev
build type where I use dagger reflect and the Debug
and Release
build types use the regular dagger.Manuel Vivo
12/18/2019, 4:36 PMkyleg
01/26/2020, 7:13 PM[Dagger/MissingBinding]
fun AddUseCase(x: Int): Reader<ReturnValType> = MyReader { ctx -> /* ... */ }
versus
class AddUseCase(ctx: MyContext) {
fun invoke(x: Int): ReturnValType { /* ... */ }
}
jw
02/04/2020, 2:00 PMJovan
02/10/2020, 9:52 PM@Module
class CoreModule {
@Provides
@AppScope
fun provideLogger(): Logger {
...
}
@Provides
@AppScope
fun provideApiService(serviceHolder: ServiceHolder, OkHttpClientBuilder: OkHttpClientBuilder): APIService {
...
}
}
@Component(
modules = [
AndroidSupportInjectionModule::class,
CoreModule::class,
MainActivityModule::class
]
)
@AppScope
interface AppComponent: AndroidInjector<MainApplication> {
@Component.Factory
interface Factory {
fun create(@BindsInstance applicationContext: Context): AppComponent
}
}
@Module
abstract class MainActivityModule {
@ContributesAndroidInjector(modules = [OnBoardingModule::class])
@ActivityScope
abstract fun mainActivity(): MainActivity
}
@Module
abstract class OnBoardingModule {
@ContributesAndroidInjector(modules = [SignInModule::class])
abstract fun signInFragment(): SignInFragment
}
Am I breaking rules doing it like this?bhatnagarm
02/13/2020, 6:47 AMJoan Colmenero
03/10/2020, 11:27 PMritesh
03/11/2020, 7:41 PMimpl
not api
as i dont want to trigger app-module build if any change in above to modules.
And it has use cases and Dagger @Module class with above @Modules added (data and api)
Something like this
@Module(includes = [ApiModule::class, DatabaseModule::class])
object AppModule
app-module -> the ui layer, dependent on domain module using impl
not api, and this module has Dagger components.
Problem starts when dagger kicks in, whe dagger builds the graph it generated all the factories in the generated folder for providers in the sepecific modules like for ApiModule in its own and DatabaseModule in it's own and they are only exposed in domain layer and domain layer in app layer by impl.
After compilation dagger throws AppComponent not found. The issue i found was it was not able to reach the generated factor classes from app-layer as app-layer is dependent on domain and domain on data and api-layer using impl
not api
and changin to api
fixed by issue.
But, i dont want to go this way, because if any changes in the outer layers (data and api) the build will also be trigerred for app-layer if exposed by api.
I am thinking of keeping the all providers classes in the domain-layer. I think it will work.
Am I breaking any rules or there is a better way to do it.Colton Idle
03/13/2020, 9:10 AMColton Idle
03/14/2020, 2:25 PMerror: Dagger does not support injection into Kotlin objects
I'm admittedly someone still very new to dagger and so I'm not sure if I'm violating some overarching DI rules with trying to inject my moshi instance into my "util object". Can someone point me in the right direction of a solution? I suppose I can write extension methods instead of having this java util that was converted to a kotlin object?Ahmed Ibrahim
03/15/2020, 7:42 PM@JvmSuppressWildCard
problem when injecting generic classes through Dagger?
It is becoming too ugly for me 😞
internal class SalesSectionReader @Inject constructor(
private val sectionsLocalDataSource: SectionsDataSource,
private val saleEntityToSaleSectionSaleMapper: Mapper<@JvmSuppressWildcards SaleEntity, @JvmSuppressWildcards SaleSection.Sale>,
private val blogEntityToBlogSectionMapper: Mapper<@JvmSuppressWildcards BlogEntity, @JvmSuppressWildcards SaleSection.Blog>,
private val tagEntityToSaleSectionTagMapper: Mapper<@JvmSuppressWildcards TagEntity, @JvmSuppressWildcards SaleSection.Tag>
) : StoreListReader<AllSectionsKey, SaleSection>
Colton Idle
03/18/2020, 3:55 PMColton Idle
03/19/2020, 12:54 AMColton Idle
03/19/2020, 12:54 AMstreetsofboston
03/19/2020, 1:08 AMjw
03/19/2020, 1:31 AMColton Idle
03/19/2020, 1:32 AMjw
03/19/2020, 1:32 AMColton Idle
03/19/2020, 1:35 AMjw
03/19/2020, 1:35 AMColton Idle
03/19/2020, 1:37 AM