java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState caused by launchFragmentInContainer

前端 未结 1 1013
忘了有多久
忘了有多久 2021-01-12 08:42

I am trying to test the app workflow. The navigation component has been used to define the app workflow. Have used FragmentScenario for testing the navigation from one frag

1条回答
  •  一整个雨季
    2021-01-12 09:23

    Make sure the device you are running the tests on is unlocked. If the screen is off or at the lock screen you will get a stack trace that looks roughly like this:

    java.lang.RuntimeException: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at androidx.test.runner.MonitoringInstrumentation.runOnMainSync(MonitoringInstrumentation.java:441)
    at androidx.test.core.app.ActivityScenario.onActivity(ActivityScenario.java:564)
    at androidx.fragment.app.testing.FragmentScenario.internalLaunch(FragmentScenario.java:300)
    at androidx.fragment.app.testing.FragmentScenario.launchInContainer(FragmentScenario.java:282)
    at com.foo.package.YourFragmentTest.yourTestFunction(YourFragmentTest.kt:xy)
    
    Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    

    0 讨论(0)
提交回复
热议问题