6

I'm trying to add Dagger2 to my project in Android Studio.

This is my dependencies.

compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
provided 'javax.annotation:jsr250-api:1.0'

I am following this example.

https://guides.codepath.com/android/Dependency-Injection-with-Dagger-2#advantages

I am getting this error.

Can not resolve symbol DaggerNetComponent

I tried changing dependencies and other solution found after googling. but no luck.

Can anyone help me on this?

Devesh Agrawal
  • 8,982
  • 16
  • 82
  • 131
  • In my case, the name of the component while building (with Dagger prefixed) was perfect, still it throws error. After making sure the component is really generated after build, I just removed the component name and added the same again..then it worked. Looks silly but that is how it is fixed :) – cgr Apr 13 '17 at 08:29

1 Answers1

4

The DaggerNetComponent is generated after compilation. You should enable annotation processing in compilation to generate that file. This link has the details.

These generated file should be added to the source path of the project to get recognized.

Community
  • 1
  • 1
rabhis
  • 440
  • 2
  • 5