question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dagger not finding an Autofactory generated class after updating to 2.18

See original GitHub issue

I’m running into a strange thing trying to update from Dagger 2.16 to 2.17/18 Dagger fails, complaining an AutoFactory generated class isn’t present.

If I copy the AutoFactory generated implementation into my code and remove the @AutoFactory annotation, then everything compiles fine. I haven’t found anything that’s obviously different about this class, and I haven’t been able to reproduce it yet. There are three other AutoFactory classes in the same package which work fine once this one is removed. The Factory class does seem to be generated too, just Dagger doesn’t see it.

The relevant bit of the stack trace when building with 2.18 is

Caused by: java.lang.TypeNotPresentException: Type MyClassFactory not present
    at dagger.internal.codegen.DaggerTypes$1.visitError(DaggerTypes.java:181)§
    at dagger.internal.codegen.DaggerTypes$1.visitError(DaggerTypes.java:167)
    at com.sun.tools.javac.code.Type$ErrorType.accept(Type.java:1855)
    at dagger.internal.codegen.DaggerTypes.checkTypePresent(DaggerTypes.java:164)
    at dagger.internal.codegen.RequestKinds.getRequestKind(RequestKinds.java:105)
    at dagger.internal.codegen.DependencyRequestValidator.validateDependencyRequest(DependencyRequestValidator.java:59)
    at dagger.internal.codegen.ComponentValidator.lambda$validate$1(ComponentValidator.java:214)
    at dagger.internal.codegen.ComponentValidator.validate(ComponentValidator.java:167)
    at dagger.internal.codegen.ComponentProcessingStep.processSubcomponents(ComponentProcessingStep.java:210)
    at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:121)
    at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:45)
    at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
    at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
    at org.gradle.api.internal.tasks.compile.processing.DelegatingProcessor.process(DelegatingProcessor.java:62)
    at org.gradle.api.internal.tasks.compile.processing.DynamicProcessor.process(DynamicProcessor.java:51)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1039)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1180)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
    at com.sun.tools.javac.main.Main.compile(Main.java:523)
    ... 63 more

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
Zhuindencommented, Feb 15, 2020

Try this in build.gradle:

kapt {
    correctErrorTypes = true // https://github.com/google/dagger/issues/435#issuecomment-441723285
}
0reactions
BoDcommented, Dec 2, 2018

I believe I have the same issue but not 100% sure - is there an easy way to try out future releases? Any beta releases out there?

Read more comments on GitHub >

github_iconTop Results From Across the Web

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:...
Read more >
Kapt: Dagger + AutoFactory not working : KT-10352
It seems the reason is that when the annotation processor for Dagger runs, it is not able to find the code generated by...
Read more >
Diff - platform/packages/apps/TV - Google Git
DaggerApplication ; /** The base application class for Live TV applications. ... isAudioOnly() when SDK is updated + mAudioOnly = Boolean.
Read more >
Assisted Injection and AutoFactory - Google Groups
I think we need to either pull dagger from auto-factory, or migrate to Dagger 2.0 which has no runtime, so we don't pollute...
Read more >
@Generated Annotation Using Gradlew + Dagger - ADocLib
When dagger goes to generate the code for the Component builders in ... gradlew build I get error: cannot find symbol @Generated all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found