https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

sunnat629

05/20/2021, 3:14 PM
Hey, I am working in a non UI class [Model layer] -
Copy code
private val _program = MutableStateFlow(NwProgram())
override val program: StateFlow<NwProgram> = _program

private val stateFlowScope: CoroutineScope by lazy { CoroutineScope(Dispatchers.Default) }

override val entities: StateFlow<List<NwEntity>> = program.transform {
    emit(it.entities ?: emptyList())
}.stateIn(
    scope = stateFlowScope,
    started = WhileSubscribed(5000),
    initialValue = emptyList()
)
But during building, it got -
Copy code
e: java.lang.AssertionError: Unbound symbols not allowed

Execution failed for task ':coresdk:compileDebugKotlin'.
> Internal compiler error. See log for more details
Kotlin v1.5.0
 and 
coroutines v1.5.0
So, why it’s happening? Can anyone help I was migrating 
livedata
 to 
stateflow
 in my Android project.
y

Yan Pujante

05/21/2021, 1:16 PM
Although not the same issue, I have a somewhat similar error with 1.5.0. See https://youtrack.jetbrains.com/issue/KT-46726. It is pretty hard to know what is actually failing since the error message is so generic with no details on exactly what triggered the error. I think you should try to isolate code that is failing (like I did in my issue) to the minimum. And report it as an issue. In my case the commenter suggested a workaround.
s

sunnat629

05/24/2021, 6:20 AM
Thank you for the info. 🙂
Ahh, so, it was an error because of the explicit. Android studio show that as optional that is why I removed and so I was getting the error.
4 Views