我试图了解Dagger2。我已经关注了几个例子,并且使用一个组件/模块是有道理的,但添加第二个让我困惑。我的应用程序类中不能使用多个组件吗?
两个Dagger组件都以红色突出显示并说“#34;无法解析符号..."
public class MyApplication extends Application {
StorageComponent component;
ImageDownloaderComponent imageDownloaderComponent;
@Override
public void onCreate() {
super.onCreate();
component = DaggerStorageComponent
.builder()
.storageModule(new StorageModule(this))
.build();
imageDownloaderComponent = DaggerImageDownloaderComponent
.builder()
.imageDownloaderModule(new ImageDownloaderModule(this))
.build();
}
public StorageComponent getComponent() {
return component;
}
public ImageDownloaderComponent getImageDownloaderComponent() {
return this.imageDownloaderComponent;
}
}