Closed SteinerOk closed 2 years ago
Hi, not using Hilt, but getting very similar issue with v2.40.1 after update from v2.39.1
@Subcomponent(modules = [SomeModule::class])
abstract class SomeSubcomponent {
@Subcomponent.Factory
interface Factory {
fun create(@BindsInstance instance: InstanceType): SomeSubcomponent
}
}
Results in failure:
Caused by: java.lang.IllegalStateException: no component requirement expression found for
ComponentRequirement{kind=BOUND_INSTANCE, wrappedType=MoreTypes.equivalence().wrap(com.example.InstanceType),
overrideNullPolicy=Optional.empty, key=Optional[com.example.InstanceType], variableName=arg0}
Changing to
@Subcomponent(modules = [SomeModule::class])
abstract class SomeSubcomponent {
@Subcomponent.Builder
interface Builder {
@BindsInstance
fun instance(instance: InstanceType): Builder
fun build(): SomeSubcomponent
}
}
Fixes the issue, but fails later on different case of using the @Subcomponent.Factory
.
@jraska I wasn't able to repro the failure. Would you be able to create a sample project that repros this case?
Thanks for the fast reply :)
Will try soon once I get time for it - the snippets were extracted from larger project, though except subcomponents there is nothing too exotic 🤔
@jraska thanks, I had some time to play around with it a bit more and was able to reproduce your error by moving the subcomponent into a separate Gradle module.
I think I found the issue and have a fix that I'll get out this week.
First of all: with 2.39.1 project compiles and run fine. After updating Dagger to 2.40 the project stopped building and gives an error:
I added code for disabling enableAggregatingTask:
After that, the build of the project is completed successfully, but at startup I get the application crash with the following error in the logs: