不确定我在应用程序中更改了什么,但我在发布后突然得到了这个无法跟踪的堆栈跟踪(我更新了一些依赖项,但不确定是什么原因导致了它,因为我无法复制)。
atal Exception: java.lang.IllegalStateException: no event down from INITIALIZED
at androidx.lifecycle.LifecycleRegistry.backwardPass(LifecycleRegistry.java:281)
at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:302)
at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148)
at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
at androidx.fragment.app.FragmentViewLifecycleOwner.handleLifecycleEvent(FragmentViewLifecycleOwner.java:62)
at androidx.fragment.app.Fragment.performDestroyView(Fragment.java:3130)
at androidx.fragment.app.FragmentStateManager.destroyFragmentView(FragmentStateManager.java:706)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1407)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1477)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1555)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1608)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3046)
at androidx.fragment.app.FragmentManager.dispatchDestroyView(FragmentManager.java:3018)
at androidx.fragment.app.Fragment.performDestroyView(Fragment.java:3128)
at androidx.fragment.app.FragmentStateManager.destroyFragmentView(FragmentStateManager.java:706)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1407)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1477)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1555)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1617)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2150)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2061)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1957)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3056)
at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2983)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2923)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:562)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1324)
at androidx.fragment.app.FragmentManager.addAddedFragments(FragmentManager.java:2392)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2137)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2061)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1957)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3056)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2990)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:251)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:458)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:210)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1392)
at android.app.Activity.performStart(Activity.java:7338)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3172)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:186)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:171)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:148)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:76)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1988)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:7240)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)
6条答案
按热度按时间snz8szmq1#
issue的修复现在在
androidx.fragment:fragment-ktx:1.3.0
中是稳定的。guicsvcw2#
此issue已修复,现在稳定。
用法:
androidx.fragment:fragment-ktx:1.3.0
xpcnnkqh3#
navController.navigate
在onCreate
中时出现此错误,因此我将检查意图的代码移至onResume
-问题解决kfgdxczn4#
如果在组合测试中发生这种情况,则需要从Composable内部调用
navHostController.navigate(...)
,即qyzbxkaa5#
发生此崩溃是因为导航和起始目标之间的id相同。您的导航和目标应该具有唯一的id。
例如:
这是崩溃:
这是正确的:
oxcyiej76#
我在编写一个涉及导航组合的测试时遇到了这个问题,请确保在主线程上调用
navigate
,例如使用ComposeTestRule#runOnUiThread
。或者,您可以从组合语句中定义的效果调用它。