You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WearOS应用Compose旋转事件分发崩溃问题咨询

关于WearOS Compose应用中Rotary事件触发的致命异常分析

这是Compose焦点系统内部状态不一致引发的致命崩溃,触发时机是用户操作旋转表冠(Rotary事件)时,焦点系统处于已失效状态,属于框架内部逻辑问题,但会直接导致应用崩溃。

是否需要关注?

  • 必须关注,优先级中等
    • 这是致命异常(Fatal Exception),会直接导致应用闪退,严重影响用户体验,用户会将崩溃责任归于你的应用,而非Compose框架。
    • 虽然不是业务代码触发,但用户的正常操作(旋转表冠)会触发该崩溃,覆盖的用户群体是使用带旋转表冠的WearOS设备用户,不可忽视。

处理建议

  • 优先升级Compose依赖:这类框架内部崩溃通常在后续版本中会被修复,检查当前使用的androidx.compose.ui:ui等相关依赖版本,升级到最新稳定版。
  • 临时规避(谨慎使用):如果暂时无法升级,可以尝试在Rotary事件处理相关逻辑外层添加try-catch,捕获IllegalStateException,避免应用崩溃,但需注意这可能掩盖焦点系统的其他状态问题。
  • 收集崩溃上下文:查看Crashlytics中的崩溃设备型号、WearOS版本、用户操作路径,确认是否是特定设备或系统版本触发,辅助定位问题。

异常堆栈信息

Fatal Exception: java.lang.IllegalStateException: Dispatching rotary event while focus system is invalidated.
   at androidx.compose.ui.focus.FocusOwnerImpl.dispatchRotaryEvent(FocusOwnerImpl.kt:319)
   at androidx.compose.ui.platform.AndroidComposeView.handleRotaryEvent(AndroidComposeView.android.kt:1964)
   at androidx.compose.ui.platform.AndroidComposeView.dispatchGenericMotionEvent(AndroidComposeView.android.kt:1911)
   at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2578)
   at android.view.View.dispatchGenericMotionEvent(View.java:16372)
   at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2578)
   at android.view.View.dispatchGenericMotionEvent(View.java:16372)
   at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2578)
   at android.view.View.dispatchGenericMotionEvent(View.java:16372)
   at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2578)
   at android.view.View.dispatchGenericMotionEvent(View.java:16372)
   at com.android.internal.policy.DecorView.superDispatchGenericMotionEvent(DecorView.java:504)
   at com.android.internal.policy.PhoneWindow.superDispatchGenericMotionEvent(PhoneWindow.java:1962)
   at android.app.Activity.dispatchGenericMotionEvent(Activity.java:4550)
   at com.android.internal.policy.DecorView.dispatchGenericMotionEvent(DecorView.java:468)
   at android.view.ViewRootImpl$ViewPostImeInputStage.processGenericMotionEvent(ViewRootImpl.java:7660)
   at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:7330)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6723)
   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6780)
   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6746)
   at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6912)
   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6754)
   at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6969)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6727)
   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6780)
   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6746)
   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6754)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6727)
   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6780)
   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6746)
   at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6945)
   at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:7170)
   at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:4815)
   at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:4219)
   at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:4210)
   at android.view.inputmethod.InputMethodManager.-$$Nest$mfinishedInputEvent()
   at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:4792)
   at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:181)
   at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
   at android.os.MessageQueue.next(MessageQueue.java:349)
   at android.os.Looper.loopOnce(Looper.java:189)
   at android.os.Looper.loop(Looper.java:317)
   at android.app.ActivityThread.main(ActivityThread.java:8592)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

内容的提问来源于stack exchange,提问作者iMan Biglari

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 02:49:52