https://kotlinlang.org logo
#compose
Title
# compose
l

Luca Nicoletti

08/21/2019, 4:35 PM
What does this:
Caused by: java.lang.IllegalStateException: Composition requires an active composition context
mean? What are the possible causes?
k

kioba

08/21/2019, 5:02 PM
based on the some quick search seems like the composition context is for to contain the Slot Table and it it referenced as a
root
. My assumption based on that is you are calling a compose function without a root to be able to attach itself.
if you comment out the
SetContent
function in your activity you can achieve the same result:
Copy code
//setContent {
        epicContent()
//}
r

Ryan Mentley

08/21/2019, 5:29 PM
It sounds like you're calling a composable function outside of a composable function - it's like suspend, they can only be called from other composables
l

Luca Nicoletti

08/22/2019, 7:44 AM
Trying to debug it, I have a breakpoint inside every
@Composable
function I have, it crashed before even reaching any breakpoints :s
r

Ryan Mentley

08/22/2019, 7:47 PM
what's the stack trace?
l

Luca Nicoletti

08/23/2019, 7:31 AM
Found out what was the problem 🙂
Was using some composable functions (
+state
) to assign values to
val
, outside of a
@composable
function
Not only in function though
You could declare them as I did in a class
c

Chuck Jazdzewski [G]

08/23/2019, 6:04 PM
@kioba That is the plan. We plan make effects
@Composable
functions that return values. When that is done they will be reported as errors just as trying to call an
@Composable
outside and
@Composable
is an error.
👍 2
3 Views