Search code examples
androiddagger-2autofactory

Dagger2 : Cannot find symbol @Autofactory classes


I want to migrate my project from dagger 1 to dagger 2. after adding dagger 2 dependent libraries i am getting " error: cannot find symbol class MyClassFactory" error for all @Autofactory classes in my project. However i see that these classes are generated but not recognised by IDE. This Classes worked fine with dagger1. could someone help me if they faced similar issue ?

i am using following libraries.

compile('com.google.auto.factory:auto-factory:1.0-beta3') {
        exclude module: 'guava'
        exclude module: 'javawriter'
        exclude module: 'dagger'
    }
    apt 'com.google.auto.factory:auto-factory:1.0-beta3'

   compile('com.google.auto.service:auto-service:1.0-rc2') {
       exclude module: 'guava'
    }
   apt 'com.google.auto.service:auto-service:1.0-rc2'


    //Dagger 2
    compile 'com.google.dagger:dagger:2.7'
    apt 'com.google.dagger:dagger-compiler:2.7'
    compile 'javax.annotation:jsr250-api:1.0'

Please help.


Solution

  • You probably have other compilation failures which block AutoFactory from generating any code. Try looking through the entire error log or increasing the error count as a javac flag to see if there's a dagger issue. This works in general - we have a dagger+ AutoFactory integration test