首页 > 解决方案 > 在 android 中使用 dagger2 时缺少 DaggerAppComponent

问题描述

我尝试使用一个项目来启动带有 dagger2 的 android,但我发现所有项目都没有 DaggerAppComponent 文件。例如:

import iammert.com.dagger_android_injection.di.DaggerAppComponent; // The missing file

public class AndroidSampleApp extends DaggerApplication {
    protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
        AppComponent appComponent = DaggerAppComponent.builder().application(this).build();
        appComponent.inject(this);
        return appComponent;
    }
}

标签: androiddagger-2

解决方案


推荐阅读