We are seeing the same issue as #1761 with version 2.27 but for a Factory being generated:
[WARN] Issue detected with dagger.internal.codegen.ComponentProcessor. Expected 1 originating source file when generating .../source/kapt/debug/com/squareup/foo/Bar_Factory.java, but detected 0: [].
It seems to be generated because of this method in a module:
@SingleIn(AScope.class) @Binds
abstract Foo provideFoo(Bar bar);
This fixed it for me.
https://github.com/google/dagger/issues/1761#issuecomment-597138608
I just had to add kapt(Deps.Dagger2.compiler) to the module where my Bar is located.
@luis-cortes is right. Incremental kapt does not work if the originating element is not in the current compilation set, you must run the dagger compiler over your upstream projects with injections. Not really a dagger problem, though you can try enabling warnIfInjectionFactoryNotGeneratedUpstream to warn about this more eagerly in your builds: https://github.com/google/dagger/blob/master/java/dagger/internal/codegen/compileroption/CompilerOptions.java#L61
It's good to do this in general anyway, as you may otherwise have multiple intermediary projects generating this factory class and result in duplicate classes
I'm working on the same project as @stephanenicolas. We definitely don't run the Dagger annotation processor in all modules that contain an inject constructor. However, knowing that this is an issue it's surprising to rarely see the warning. We should see it in way more modules and constantly, but that's not the case.
Most helpful comment
I'm working on the same project as @stephanenicolas. We definitely don't run the Dagger annotation processor in all modules that contain an inject constructor. However, knowing that this is an issue it's surprising to rarely see the warning. We should see it in way more modules and constantly, but that's not the case.