0

When running my program from AS, I usually get this error:

error: cannot find symbol class DaggerActivityComponent

I've tried the remedies suggested at Cannot find symbol class "Generated" for Dagger 2, but the problem continues. I can get around the error by doing clean and rebuild before run. This is a pain, of course. I don't see a pattern for when the error does not occur.

I'm using Dagger version 2.0.2

In build.gradle, I've made the suggested changes: (I was unable to use SNAPSHOT-2.1 version of Dagger)

//Required by Dagger2
compile 'org.glassfish:javax.annotation:10.0-b28'
// Alternate to above as
// provided 'javax.annotation:jsr250-api:1.0'
compile "com.google.dagger:dagger:$DAGGER_VERSION"

The other members on my team are not experiencing this, so I suspect it might be related to my configuration for Android Studio.

Thank you for any further ideas.

Community
  • 1
  • 1
Mark Murphy
  • 1,580
  • 1
  • 16
  • 29

2 Answers2

1

there must be some error in your using of @Inject annotations. if you have done everything correct, you can try 'Build -> Clean Project' and then 'Build -> Make Project'.. It works for me.

Julian Raj
  • 62
  • 2
  • thanks. I have been doing this and it does work. I'd like to just hit though. There might be an error in the annotations, but I don't know why it would affect only me and not other team members. – Mark Murphy Jan 22 '16 at 17:07
  • there must be some error in your using of @Inject annotations. – Nouman Ch May 26 '18 at 13:11
0

By chance, I tried hitting the <Run> button a second time when this error occurred and it turns out that gets around the problem.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Mark Murphy
  • 1,580
  • 1
  • 16
  • 29