android - 在 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;
}
}
解决方案
推荐阅读
- css - 切出滚动条的元素
- c++ - 使用 FTLK 库设置我的 MacOS Catalina C++ 编码环境
- bash - 使用bash脚本从变量中的函数返回多个值
- android - 此处不允许元素 LinearLayout - 在 RelativeLayout 内
- git - 试图通过命令行将项目上传到 github,但它说 PERMISSION TO [old account name] denied
- arrays - 如何将地图列表中的项目显示到列表视图中
- javascript - 重构组件 ReactJS
- android - 如何使用 firebase 实时数据库中的键值或字段键删除所有字段和值?
- python - 提高 Python 中字典搜索的性能
- angular - 根据可观察服务返回的数据创建动态下拉列表