I am using Dagger and so far its good. I have one module for all the Views (Activities and fragments), and I am injecting them through Object graph. Now I want to include Custom view and my Module looks something like this
@Module(
injects = {
//Activity
MainActivity.class,
//Fragments
LookupSearchResultsFragment.class,
// Views
MainSearchComponent.class
},
//includes = {
// PersistenceModule.class
//},
library = true,
complete = false,
addsTo = AndroidModule.class)
In my MainSearchComponent how should I inject Object Graph? I am currently doing this:
ObjectGraph.create((BaseActivity)getContext()).inject(this);
But I get this error. Caused by: java.lang.IllegalStateException: Module adapter for class ...MainActivity could not be loaded. Please ensure that code generation was run for this module.