0

I downloaded several sample projects from github that use dagger, e. g. Moxy sample project (trying to run github-sample) but everywhere there is the same error - «cannot find symbol class DaggerAppComponent». I did not make any changes in the projects just downloaded and tried to run them.

Gradle version - 3.1.2 AndroidStudio – 3.3

def dagger = '2.7'
implementation "com.google.dagger:dagger:$dagger"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger"

Does anybody has an idea how to fix it?

Svetlana Rozhkova
  • 181
  • 1
  • 3
  • 10

2 Answers2

4

Adding the below dependency.

implementation 'com.google.dagger:dagger:2.x'

annotationProcessor 'com.google.dagger:dagger-compiler:2.x'

OR try this

annotationProcessor 'com.google.dagger:dagger-compiler:2.12'

ADM
  • 20,406
  • 11
  • 52
  • 83
2

This may not be directly related to what the original poster was looking for but posting this answer for anyone looking to solve a similar error. If you have converted some of your classes to Kotlin then use kapt instead of annotationProcessor in your build.gradle. It is kind of obvious looking back but took me a while to figure out why I'm getting the sysmbol not found error with DaggerAppComponenent without any other details.

Alan
  • 667
  • 5
  • 15
  • I've lost one hour, until I found this answer... I needed to use the @Bindable annotation in a kotlin file, which required me to use the kapt-plugin, and then I couldn't build the app anymore. Just replaced annotationProcessor with kapt and it worked! Thanks – Massimo Sep 23 '20 at 09:30