sockeqwe / mosby

A Model-View-Presenter / Model-View-Intent library for modern Android apps
http://hannesdorfmann.com/mosby/
Apache License 2.0
5.49k stars 841 forks source link

There is an NPE in MenuPresenter if i try to start the sample mail app (but not only there) #315

Open HowardSchmaeu opened 6 years ago

HowardSchmaeu commented 6 years ago

may is the same like https://github.com/sockeqwe/mosby/issues/298 but i don't know. First i got this problem in my own code and then i just download the actual Mosby Source to debug it but then i got the same in the sample mail app I got THIS if i try to start the sample mail app:

java.lang.NullPointerException: Attempt to invoke interface method 'com.hannesdorfmann.mosby3.sample.mail.menu.MenuPresenter com.hannesdorfmann.mosby3.sample.mail.menu.MenuComponent.presenter()' on a null object reference at com.hannesdorfmann.mosby3.sample.mail.menu.MenuFragment.createPresenter(MenuFragment.java:91) at com.hannesdorfmann.mosby3.sample.mail.menu.MenuFragment.createPresenter(MenuFragment.java:44) at com.hannesdorfmann.mosby3.mvp.delegate.FragmentMvpViewStateDelegateImpl.createViewIdAndPresenter(FragmentMvpViewStateDelegateImpl.java:340) at com.hannesdorfmann.mosby3.mvp.delegate.FragmentMvpViewStateDelegateImpl.onCreate(FragmentMvpViewStateDelegateImpl.java:116) at com.hannesdorfmann.mosby3.mvp.MvpFragment.onCreate(MvpFragment.java:98) at com.hannesdorfmann.mosby3.sample.mail.base.view.BaseLceFragment.onCreate(BaseLceFragment.java:45) at com.hannesdorfmann.mosby3.sample.mail.base.view.AuthFragment.onCreate(AuthFragment.java:45) at android.support.v4.app.Fragment.performCreate(Fragment.java:2246) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1377) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1650) at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1906) at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3698) at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:350) at android.support.v4.app.BaseFragmentActiv

pawelnbd1992 commented 5 years ago

Someone fixed this issue ? @sockeqwe give me a hint where to look error.

HowardSchmaeu commented 5 years ago

okay ... today i found an issue what may depends on THAT issue here or is the root... i don't know but may it helps to find something.

i had the problem that my Fragment or better the Base Class calls the onDestroyView() on a not expected point. i use almost the same Base Class like this from the origin:

BaseViewStateFragment

i was a bit confused because i had not this issue in all my other 2 mosby projects. After a bit investigation i changed back this project to mosby 2 because that was the only different to the other projects.

And voila it just works. it did NOT call onDestroyView()

I've NO Idea why and where it comes from but now it works.

@sockeqwe : may it helps to find the real root :)

leslieam commented 5 years ago

java.lang.NullPointerException: Presenter returned from createPresenter() is null. I've got the same issue when I switch to 3.1.0 or 3.1.1. It worked on mosby 3.0.1.