I am working on an existing project with a very big recycler view (chat feed) i have a component tha...
z
I am working on an existing project with a very big recycler view (chat feed) i have a component that is written in compose and is introduced by inflating an XML viewHolder with
ComposeView
in it. When i try to measure this view i get
Copy code
IllegalStateException: Cannot locate windowRecomposer; View androidx.compose.ui.platform.ComposeView{6542dd8 V.E...... ......I. 0,0-0,0 #7f0a0206 app:id/composeView} is not attached to a window
If i dont try to measure the view everything works fine. It crashes even if i dont invoke
setContent
What can be the problem?
z
Which version of compose? Is the xml inflated into a subclass of ComponentActivity?
z
Compose 1.2.0, inflated onto AppCompatActivity.
z
1.2 is quite old at this point, if you can repro with 1.4 then please file a bug.
m
Hello 👋 I’m having the same issue. Do you have any solution or is it fixed with Compose 1.4? I tried on Compose 1.3.2, but I still have the same crash 😞
N.B I’m not using Compose 1.4 right now because I can’t use Kotlin 1.8 (because of Kotlin Poet compatibility).
z
Feel free to file a bug so we can track this if it is actually still happening in newer versions
m
Hi, So finally, the issue seemed to be between Flexbox and Composeview. I’ve solved my issue by replacing my
RecyclerView
+
FlexboxLayoutManager
by a
FlexboxLayout
. More details here: https://github.com/google/flexbox-layout/issues/613
167 Views