Skip to content

Compile issue when updating from 2.57.1 to 2.57.2 #4997

Open

Description

@denis-colliot

When trying to upgrade to patch version 2.57.2 (from version 2.57.1), I'm facing the following issue (for the first time):

> Task :app:hiltJavaCompileWeeklyDebug FAILED
error: ComponentProcessingStep was unable to process 'com.comuto.squirrel.MainApp_HiltComponents.SingletonC' because 'io.getstream.chat.android.client.plugin.factory.PluginFactory' could not be resolved.
  
  Dependency trace:
      => element (CLASS): com.comuto.squirrel.android.datasource.chat.di.ChatApiModule
      => element (METHOD): provideOfflinePluginFactory(android.content.Context)
      => type (EXECUTABLE method): (android.content.Context)io.getstream.chat.android.client.plugin.factory.PluginFactory
      => type (ERROR return type): io.getstream.chat.android.client.plugin.factory.PluginFactory
  
  If type 'io.getstream.chat.android.client.plugin.factory.PluginFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'io.getstream.chat.android.client.plugin.factory.PluginFactory' is on your classpath.
1 error

  error: ComponentProcessingStep was unable to process 'com.comuto.squirrel.MainApp_HiltComponents.SingletonC' because 'io.getstream.chat.android.client.plugin.factory.PluginFactory' could not be resolved.

The ChatApiModule of my modularized app exposes the third-party type PluginFactory:

import io.getstream.chat.android.client.plugin.factory.PluginFactory
import io.getstream.chat.android.offline.plugin.factory.StreamOfflinePluginFactory
import io.getstream.chat.android.state.plugin.config.StatePluginConfig
import io.getstream.chat.android.state.plugin.factory.StreamStatePluginFactory

@Module
@InstallIn(SingletonComponent::class)
internal object ChatApiModule {

    @Qualifier
    @Retention(AnnotationRetention.RUNTIME)
    annotation class ClientOfflinePluginFactory

    @Qualifier
    @Retention(AnnotationRetention.RUNTIME)
    annotation class ClientStatePluginFactory

    @Provides
    @ClientOfflinePluginFactory
    fun provideOfflinePluginFactory(@ChatApplicationContext applicationContext: Context): PluginFactory =
        StreamOfflinePluginFactory(appContext = applicationContext)

    @Provides
    @ClientStatePluginFactory
    fun provideStatePluginFactory(@ChatApplicationContext applicationContext: Context): PluginFactory =
        StreamStatePluginFactory(
            appContext = applicationContext,
            config = StatePluginConfig(backgroundSyncEnabled = true, userPresence = true)
        )
}

Here's a preview of the app configuration:

  • Gradle 9.1.0
  • AGP 8.13.0
  • :app module's build.gradle.kts:
    plugins {
        id("com.android.application")
        id("com.google.devtools.ksp") // KSP version: 2.2.20-2.0.4
        id("com.google.dagger.hilt.android")
        kotlin("android")
    }
    
    hilt {
        enableAggregatingTask = true
    }
    
    dependencies {
        implementation(libs.google.hilt.android) // com.google.dagger:hilt-android:2.57.2
        ksp(libs.google.hilt.compiler) // com.google.dagger:hilt-compiler:2.57.2
    
        implementation(project(":chat"))
    
        // [...]
    }
  • :chat module's build.gradle.kts:
    plugins {
        id("com.android.library")
        id("com.google.devtools.ksp") // KSP version: 2.2.20-2.0.4
        kotlin("android")
    }
    
    android {
        namespace = "com.comuto.squirrel.android.api.chat"
    }
    
    dependencies {
        implementation(libs.google.hilt.core) // com.google.dagger:hilt-core:2.57.2
        ksp(libs.google.hilt.compiler) // com.google.dagger:hilt-compiler:2.57.2
        implementation(libs.getStreamChat.client) // io.getstream:stream-chat-android-client:6.24.0
        implementation(libs.getStreamChat.offline) // io.getstream:stream-chat-android-offline:6.24.0
        implementation(libs.getStreamChat.state) // io.getstream:stream-chat-android-state:6.24.0
    
        // [...]
    }

Activity

  1. bcorso commented on Oct 20, 2025

    @bcorso

    The issue is that your module's @Provides method is returning PluginFactory, which isn't on the classpath whenever Dagger generates its component in :app.

    In order to fix it you would either need to change the corresponding dependency to api within :chat (e.g. dependencies { api(libs.getStreamChat.client) }), or you would need to add the dependency directly to :app.

    However, I'm not sure what could have caused that change between Dagger 2.57.1 and 2.57.2. That's a restriction that should have been there for years. Are you sure nothing else changed except the Dagger version?

  2. denis-colliot commented on Oct 20, 2025

    @denis-colliot
    Author

    Thanks for your quick answer Brad!

    you would either need to change the corresponding dependency to api [...] or you would need to add the dependency directly to :app.

    I feel like replacing api with implementation would break the "modular mindset"; idea is to have a decoupled :chat module, abstracting its internal dependencies from its consumers.

    Declaring these 3rd-party dependencies in the :app module seems to solve the issue ⇒ I guess I'll go with this solution.

    Are you sure nothing else changed except the Dagger version?

    Positive, I encountered this issue in a Renovate-generated PR that only upgrades the version of the com.google.dagger:hilt-* dependencies.

    I'm also very curious to figure out what caused this constraint to be suddenly applied by a patch version 🤔 (I've been using Google Dagger Hilt for years now)

  3. bcorso commented on Oct 21, 2025

    @bcorso

    @denis-colliot I met with the team today and @Chang-Eric reminded me that technically Hilt's plugin should already take care of pulling the transitive dependencies onto the classpath (via enableAggregatingTask). Looking at what changed between Dagger 2.57.1 and 2.57.2 we think the following change be causing the issue:

    That fix was required for using Gradle 9.0.0, so we'd like to verify if upgrading to Gradle 9.x resolves this issue. Would it be possible for you to upgrade to Gradle 9.x to verify this?

  4. denis-colliot commented on Oct 22, 2025

    @denis-colliot
    Author

    Thanks for investigating this issue @bcorso!

    Would it be possible for you to upgrade to Gradle 9.x to verify this?

    The app is using Gradle 9.1.0.

    I do agree that the enableAggregatingTask configuration should already take care of this.

  5. pablobaxter commented on Nov 14, 2025

    @pablobaxter

    I had a teammate run into this issue today. What's strange is that no else on the team ran into it, however he was setting up a new machine when he ran into this, so it could potentially be a bug masked by caching. After some digging, we saw that adding dependencies to the :app module resolved his issue. The setup we had:

    Gradle: 9.2.0
    Kotlin: 2.2.21
    KSP: 2.3.1
    AGP: 8.11.1

  6. adi-gnm commented on Dec 1, 2025

    @adi-gnm

    We're seeing this issue as well. For us, it only occurs on CI, but is blocking Gradle 9 upgrade due to #4847

    Gradle: 9.2.1
    Kotlin: 2.2.21
    KSP: 2.3.3
    AGP: 8.13.1

  7. guness commented on Dec 24, 2025

    @guness

    Having the same issue in a multi module project.
    Applied the workaround for now. Using api instead of implementation for the parameters that are provided via Hilt.
    Any sort of enableAggregatingTask or the old one, did not help.

    Gradle: 9.2.1
    Kotlin: 2.3.0
    KSP: 2.3.4
    AGP: 8.13.2
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions