janishar / android-dagger2-example

This project implements the dagger 2 in android for dependency injection
454 stars 196 forks source link

DaggerActivityComponent file not found #8

Closed vijayideas closed 6 years ago

vijayideas commented 6 years ago

The file not in the package- com.mindorks.example.android_dagger2_example.di.component.DaggerActivityComponent;

public ActivityComponent getActivityComponent() {
        if (activityComponent == null) {
            activityComponent = **DaggerActivityComponent**.builder()
                    .activityModule(new ActivityModule(this))
                    .applicationComponent(DemoApplication.get(this).getComponent())
                    .build();
        }
        return activityComponent;
}
EddyMM commented 6 years ago

Build the project first then the ActivityComponent will be implemented by Dagger2 (creating a DaggerActivityComponent class which you can then import).

Dagger2 formulates the dependency graph at build time so a static analyzer would mark the DaggerActivityComponent as not found.