Hey everyone. i am getting this exception when na...
# compose
p
Hey everyone. i am getting this exception when navigating to a
fragment with ComposeView
Copy code
Fatal Exception: java.lang.IllegalStateException 
ViewTreeLifecycleOwner not found from androidx.constraintlayout.widget.ConstraintLayout{aace22b V.E...... ......ID 0,0-1080,2358 #7f0a114e app:id/root}
versions used
Copy code
fragment - 1.3.1 
compose - 1.0.2
i
Is there a reason you aren't using the latest stable version of fragments? They're up to 1.3.6 at this point.
Also make sure you are using AppCompat 1.3.1 if you are using AppCompatActivity
p
yeah will try those. Any guess on what might have caused this ?
happening only in release apk though.
i
There's nothing in release mode that would make any timing difference at runtime
p
tried with updated versions, happening same. i’m using FragmentActivity as Host
i
What's the full stack trace?
p
Copy code
androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareViewTreeRecomposer (WindowRecomposer_androidKt.java:244) 
androidx.compose.ui.platform.WindowRecomposer_androidKt.access$createLifecycleAwareViewTreeRecomposer (WindowRecomposer_androidKt.java:1) 
androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer (WindowRecomposerFactory.java:99) 
androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release (WindowRecomposerPolicy.java:155) 
androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer (WindowRecomposer_androidKt.java:230) 
androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext (AbstractComposeView.java:220) 
androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated (AbstractComposeView.java:227) 
androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow (AbstractComposeView.java:259) 
android.view.View.dispatchAttachedToWindow (View.java:20626) 
android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3514) 
android.view.ViewGroup.addViewInner (ViewGroup.java:5303) 
android.view.ViewGroup.addView (ViewGroup.java:5089) 
android.view.ViewGroup.addView (ViewGroup.java:5029) 
androidx.fragment.app.FragmentStateManager.addViewToContainer (FragmentStateManager.java:833) 
androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:523) 
androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:282) 
androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:2189) 
androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:2100) 
androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:2002) 
androidx.fragment.app.FragmentManager.executePendingTransactions (FragmentManager.java:600)
i
Does anything change if you use AppCompatActivity?
p
can’t see any change with AppCompatActivity too
tried removing obfuscation in release apk, happening same. onPreCreate() of compose screen is getting called though.
one difference that i was able to find between release apk and debug apk is
Copy code
findViewTreeCompositionContext()
is returning null in release apk. whereas a recomposer is getting returned in debug apk. Also, lifecycleOwner get is returning null
i
I'd file an issue against Compose if you can reproduce this in a sample project
153 Views