Trying to inject into an Android `Worker` as per <...
# kodein
r
Trying to inject into an Android
Worker
as per https://stackoverflow.com/questions/59546159/kodein-injecting-into-workmanager -- however, as soon as I extend from
DIAware
, I get
e: java.lang.IllegalStateException: Backend Internal error: Exception during file facade code generation
at compile time. Any ideas?
Copy code
Caused by: java.lang.IllegalStateException: Error type encountered: [ERROR : <ERROR FUNCTION RETURN TYPE>] (DeferredType).
	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:110)
	at org.jetbrains.kotlin.load.kotlin.TypeSignatureMappingKt.mapType(typeSignatureMapping.kt:101)
	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:262)
	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapReturnType(KotlinTypeMapper.kt:197)
For some reason, I had to be explicit about the types in this class -- instead of writing
override val di by di { context }
I had to write
override val di: DI by di { context }
. Could be https://youtrack.jetbrains.com/issue/KT-37796.
Ah, no the wrong
di
for
di { context }
was being imported.