Why am I getting "Unable to pause activity IllegalStateException: Restarter must be created only during owner's initialization stage" in Android?
Asked Answered
C

0

14

I am using a FragmentActivity and sometimes on Crashlytics, I am able to see an exception Fatal Exception: java.lang.RuntimeException: Unable to pause activity

Below is the onPause of my FragmentActivity

@Override
protected void onPause() {
    super.onPause();
    if (EventBus.getDefault().isRegistered(this))
        EventBus.getDefault().unregister(this);
}

Here is the stack trace of this crash.

Fatal Exception: java.lang.RuntimeException: Unable to pause activity {com.avail.easyloans.android/com.avail.easyloans.feature.marketplace.activities.ActivityMarketplace}: java.lang.IllegalStateException: Restarter must be created only during owner's initialization stage
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3471)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3430)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3402)
       at android.app.ActivityThread.access$1300(ActivityThread.java:151)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1416)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:157)
       at android.app.ActivityThread.main(ActivityThread.java:5601)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Caused by java.lang.IllegalStateException: Restarter must be created only during owner's initialization stage
       at androidx.savedstate.SavedStateRegistryController.performRestore(SavedStateRegistryController.java:59)
       at androidx.fragment.app.Fragment.performCreate(Fragment.java:2522)
       at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:834)
       at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1227)
       at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1293)
       at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2612)
       at androidx.fragment.app.FragmentManagerImpl.dispatchPause(FragmentManagerImpl.java:2588)
       at androidx.fragment.app.FragmentController.dispatchPause(FragmentController.java:279)
       at androidx.fragment.app.FragmentActivity.onPause(FragmentActivity.java:406)
       at com.avail.easyloans.feature.marketplace.activities.ActivityMarketplace.onPause(ActivityMarketplace.java:351)
       at android.app.Activity.performPause(Activity.java:6467)
       at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1312)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3457)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3430)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3402)
       at android.app.ActivityThread.access$1300(ActivityThread.java:151)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1416)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:157)
       at android.app.ActivityThread.main(ActivityThread.java:5601)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)

What can be the possible reason behind this and how can I fix this problem?

*I am not able to reproduce this bug.

Curative answered 6/4, 2019 at 6:50 Comment(2)
Is anyone got solution for this ?Lozano
@richa sgah see this: https://mcmap.net/q/505970/-backstack-management-restarter-must-be-created-only-during-owner-39-s-initialization-stageSheliasheline

© 2022 - 2024 — McMap. All rights reserved.