question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes in don't keep activities mode

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sockeqwecommented, Aug 22, 2018

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

0reactions
Eimilcommented, Dec 15, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Don't Keep Activities | by Matt Robertson - ProAndroidDev
My hypothesis was that the crash was from users who were closing the app while the splash screen was still being displayed. (For...
Read more >
do not keep activities option results in crashing my app
I tested this issue with a clean simple example: The fact is, that when the option 'do not keep activities' is checked, then...
Read more >
What is "Don't Keep Activities" in Android? - GeeksforGeeks
Basically in layman's terms Don't keep activities is a function whose job is to kill every app as soon as the user comes...
Read more >
Why Do My Apps Keep Crashing on Android? - Avast
Apps on Android can crash because of low storage space, too many apps running simultaneously, a weak internet connection, or not having the ......
Read more >
What will happen if I turn on 'don't keep activities' in ... - Quora
If you disable any important system app, it could be dangerous. Disabling some system apps may cause unstability and even crash your smartphone!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found