google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.41k stars 2.01k forks source link

Cause: couldn't make a guess for com.package.TestModule #3329

Closed vrrashkov closed 2 years ago

vrrashkov commented 2 years ago

When I updated to the latest version of hilt 2.41 I get the following error and the module is with almost nothing in it, it worked before but currently throws this exception. I couldn't find any info on what does that error mean. "couldn't make a guess for com.package.TestModule"

Execution failed for task ':app:hiltAggregateDepsDebug'.
> A failure occurred while executing dagger.hilt.android.plugin.task.AggregateDepsTask$WorkerAction
   > couldn't make a guess for  com.package.TestModule
@Module
@InstallIn(SingletonComponent::class)
object TestModule {

    @Provides
    @Singleton
    @TestModuleController
    fun provideTestModuleController() = null
}
vrrashkov commented 2 years ago

It turns out that from version 2.4 > the enableAggregatingTask is true by default, when switching it to false it fixed the issue.

bcorso commented 2 years ago

Hi @MrCroZer,

Ideally you would not disable the aggregating task because that performs a lot of useful tasks for you (see https://dagger.dev/hilt/gradle-setup#aggregating-task).

The issue is that we assume that the fully qualified class name is ASCII and follows typical Java style (lowercase package names, UpperCamelCase class names), so I think something in your package or class name is violating that.

We may be able to fix this on our side, we'll have to take a further look. However, you should also be able to fix this on your side if you ensure you use the above practice for naming. If you can't figure out what the issue is you can share your exact package and class name here and we can try to help.

vrrashkov commented 2 years ago

You are correct, the package indeed includes uppercase in it. Is there a way to fix this without changing the package to lowercase, because the app is already published in google play and is with uppercase, so I don't think it is allowed to lowercase it.

bcorso commented 2 years ago

Okay, thanks for following up. We'll look into it on our side and report back. I'll reopen this for now.