Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes in don't keep activities mode #36

Open
Denis10 opened this issue Apr 24, 2018 · 5 comments
Open

App crashes in don't keep activities mode #36

Denis10 opened this issue Apr 24, 2018 · 5 comments

Comments

@Denis10
Copy link

Denis10 commented Apr 24, 2018

There is a stable crash after such steps:

  1. Open app
  2. Open CreateTask screen
  3. Hide app
  4. Open app
  5. Hide app

The reason is in MvpConductorLifecycleListener.
When there is a controller in backstack (TasksController) method postCreateView will not be invoked. So presenter equals to null. But when you press home button it invokes postDestroy method and throws NullPointerException.

com.hannesdorfmann.mosby3.conductor.sample E/AndroidRuntime: FATAL EXCEPTION: main Process: com.hannesdorfmann.mosby3.conductor.sample, PID: 1277 java.lang.RuntimeException: Unable to destroy activity {com.hannesdorfmann.mosby3.conductor.sample/com.hannesdorfmann.mosby3.conductor.sample.MainActivity}: java.lang.NullPointerException: Presenter returned from getPresenter() is null in com.hannesdorfmann.mosby3.conductor.sample.tasks.TasksController@9221574 at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4383) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4401) at android.app.ActivityThread.-wrap5(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.NullPointerException: Presenter returned from getPresenter() is null in com.hannesdorfmann.mosby3.conductor.sample.tasks.TasksController@9221574 at com.hannesdorfmann.mosby3.mvp.conductor.delegate.MvpConductorLifecycleListener.postDestroy(MvpConductorLifecycleListener.java:81) at com.bluelinelabs.conductor.Controller.performDestroy(Controller.java:1076) at com.bluelinelabs.conductor.Controller.removeViewReference(Controller.java:972) at com.bluelinelabs.conductor.Controller.destroy(Controller.java:1097) at com.bluelinelabs.conductor.Controller.activityDestroyed(Controller.java:859) at com.bluelinelabs.conductor.Router.onActivityDestroyed(Router.java:558) at com.bluelinelabs.conductor.ActivityHostedRouter.onActivityDestroyed(ActivityHostedRouter.java:61) at com.bluelinelabs.conductor.internal.LifecycleHandler.destroyRouters(LifecycleHandler.java:209) at com.bluelinelabs.conductor.internal.LifecycleHandler.onDestroy(LifecycleHandler.java:160) at android.app.Fragment.performDestroy(Fragment.java:2768) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1432) at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1618) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3027) at android.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3007) at android.app.FragmentController.dispatchDestroy(FragmentController.java:244) at android.app.Activity.performDestroy(Activity.java:7217)

@ctarabusi
Copy link

ctarabusi commented Aug 21, 2018

We are having exactly the same problem.

I will also vote to merge the:
#37

@sockeqwe
Copy link
Owner

Dont keep activities is actually not simulating any real behavior that can happen in real life. Hence I wouldn't bother.

@ando0689
Copy link

@sockeqwe I have about 300 crashes with this same error in my production application. Don't keep activities is totally real. It just simulates situations which users will face when they put application in background for a few days and then open it. Don't keep activities just makes this process faster

@carolinsvensson
Copy link

I'm having the same problem.
@sockeqwe Any chance you could merge #37?

@Eimil
Copy link

Eimil commented Dec 15, 2019

This is quite a showstopper when it comes to certain devices, can this be merged? @sockeqwe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants