Dagger: Unable to generate factory class

Created on 3 Dec 2018  路  1Comment  路  Source: google/dagger

Recently I started doing a multi module Android project, everything was compiling fine without any problems, but the suddenly I started to get the following error

error: cannot find symbol import com.controlant.domain.di.AuthModule_ConfigurationFactory;
symbol:   class AuthModule_ConfigurationFactory   
location: package com.controlant.domain.di

I have a module class that is like follows

@Module
class AuthModule {

    @Provides
    fun configuration(): AuthConfiguration =
            AuthConfiguration(BuildConfig.CLIENT_ID, BuildConfig.CLIENT_SECRET)

}

and I'm expecting dagger to inject the configuration into this class

@Singleton
class AuthStateManager
@Inject constructor(
        private val configuration: AuthConfiguration,
        private val service: AuthService,
        private val prefs: Preferences
)

For some reason dagger is particularly failing only with this AuthConfiguration class, which is defined like so

data class AuthConfiguration(
        val clientId: String,
        val clientSecret: String,
        val granType: String = "password",
        val refreshGrantType: String = "refresh_token"
)

The AuthModule class belongs to a module named domain and it's being consumed from the main module and all classes that are needed to be injected are inside the domain module.

Like I was saying, it suddenly started to fail when trying to find the configuration factory, but for some reason if I move the AuthModule class to the main Android module then it compiles without any problem, in this same project I have other modules that do the same thing, they define the graph for it's own module and they are consumed by another one but those don't fail.

Is there anything visible that I'm doing wrong? Or is this an edge case that I just hit? I went to the directory where the generated classes are and I did not find the factory class but in the logs I can't seem to find any error, I even disabled databinding.v2 and still didn't see any error besides the symbol not found, but like I said if I move the module to the main Android module then the factory class is there.

Most helpful comment

You probably are forgetting to depend on the compiler in the domain module.

If not, I recommend moving this to StackOverflow, that's a better forum for questions.

>All comments

You probably are forgetting to depend on the compiler in the domain module.

If not, I recommend moving this to StackOverflow, that's a better forum for questions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

charbgr picture charbgr  路  27Comments

JakeWharton picture JakeWharton  路  46Comments

f2prateek picture f2prateek  路  22Comments

ronshapiro picture ronshapiro  路  52Comments

chrisjenx picture chrisjenx  路  70Comments