Dagger2 + Kotlin,注射不起作用

时间:2016-05-13 05:37:34

标签: kotlin dagger-2

不幸的是,Dagger2没有创建要注入的对象实例。

  • Dagger:2.0.2
  • Kotlin:1.0.1-2

源代码? Here

组件:

@ActivityScope @Component(dependencies = ApplicationComponent.class,
    modules = { HomeModule.class })
public interface HomeComponent {
  void inject(HomeActivity homeActivity);
  HomePresenter homePresenter();
}

模块:

@Module public class HomeModule {
  @Provides @ActivityScope HomePresenter provideHomePresenter(
      HomePresenterImpl presenter) {
    return presenter;
  }
}

1 个答案:

答案 0 :(得分:3)

只需将Dagger的版本更新为2.2