After updating from compose alpha-11 to alpha-12(or beta-01) I am getting this crash whenever I open an activity or fragment that has compose views.I am using AppCompatActivity which implements LifecycleOwner, so this is extremely odd. java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from DecorView@2da7146[MyActivity] at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareViewTreeRecomposer(WindowRecomposer.android.kt:214) at androidx.compose.ui.platform.WindowRecomposer_androidKt.access$createLifecycleAwareViewTreeRecomposer(WindowRecomposer.android.kt:1) at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(WindowRecomposer.android.kt:98) at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.android.kt:151) at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(WindowRecomposer.android.kt:199) at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.android.kt:176) at androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow(ComposeView.android.kt:207) at android.view.View.dispatchAttachedToWindow(View.java:20014) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3589) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3596) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3596) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3596) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3596) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3596) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2223) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1888) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8511) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer.doFrame(Choreographer.java:696) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7050) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)My code looks really simple: class MyActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { MaterialTheme { Text(text = "compose") } } } }UPDATEApparently you need to use androidx.appcompat:appcompat:1.3.0-beta01 解决方案 I've encountered same issue with BottomSheetDialogFragmentYou have to upgrade fragment to 1.3.1Thanks to @clapa-lucian, you can find more about in this issue 这篇关于从DecorView @ 2da7146中找不到ViewTreeLifecycleOwner [MyActivity]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-21 09:52