# compose


02/07/2022, 2:17 PM
So, i’m having an interesting issue that i’m not sure is technically a compose bug or an android studio bug. If i create a view that extends AbstractComposeView, and then reference that in an xml file, i can’t get a preview, and see this error. Looking for input on wherew to submit this bug. (for the record, i’m using ConstraintLayout 2.0.4)
Copy code
java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from androidx.constraintlayout.widget.ConstraintLayout{18da14ef V.E...... ......I. 0,0-0,0}   at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareViewTreeRecomposer(   at androidx.compose.ui.platform.WindowRecomposer_androidKt.access$createLifecycleAwareViewTreeRecomposer(   at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(   at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(   at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(   at androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext(   at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(
I’ve traced it down to this function in ViewTreeLifecycleOwner:
Copy code
    public static LifecycleOwner get(@NonNull View view) {
        LifecycleOwner found = (LifecycleOwner) view.getTag(;
        if (found != null) return found;
        ViewParent parent = view.getParent();
        while (found == null && parent instanceof View) {
            final View parentView = (View) parent;
            found = (LifecycleOwner) parentView.getTag(;
            parent = parentView.getParent();
        return found;