Skip to content

Injection is broken with the latest Dagger 2 release #44

Description

@louis-gale

EasyMVP works fine with Dagger 2.11. It is broken when migrating to Dagger 2.12. You can easily replicate this by compiling the sample tvProgram_android project against this Dagger version. When the view tries to inject the presenter you will get an error like:

java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object javax.inject.Provider.get()' on a null object reference at easymvp.loader.SupportPresenterLoader.onForceLoad(SupportPresenterLoader.java:32) at android.support.v4.content.Loader.forceLoad(Loader.java:329) at easymvp.loader.SupportPresenterLoader.onStartLoading(SupportPresenterLoader.java:26) at android.support.v4.content.Loader.startLoading(Loader.java:272) at android.support.v4.app.LoaderManagerImpl$LoaderInfo.start(LoaderManager.java:270) at android.support.v4.app.LoaderManagerImpl.doStart(LoaderManager.java:770) at android.support.v4.app.FragmentHostCallback.doLoaderStart(FragmentHostCallback.java:243) at android.support.v4.app.FragmentController.doLoaderStart(FragmentController.java:386) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:566) at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177) at com.leonard.www.tvprog.feature.channelList.view.ChannelListActivity.onStart(ChannelListActivity.java:0)

This is because the providerFactory passed to the view delegate class is null. I suspect this may be caused by a change to the way Dagger is generating its internal classes. Therefore the Dagger2Extension.apply() method is failing to correctly detect the Dagger classes.

The simply fix would be to update this class to support the new class format, however a better solution would be to rewrite the class such that its detection is based on the public annotations, etc rather than inferring information from the internal Dagger implementation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions