Skip to content

ModuleProcessingStep/BindingMethodProcessingStep error when injecting classes from flavor specific directories (2.59.2) #5130

@jamesscott-zaptec

Description

@jamesscott-zaptec

Hi,

We have been updating our app dependencies and had issues with specific builds; seeing compilation errors with ksp similar to many other issues raised in this library, however from what I've been able to reproduce we seem to be having a different issue.

I have pushed a sample project outlining a simple reproducible example, but I'll outline the findings here.

This project is using the following dependency versions:

agp = "9.0.1"
kotlin = "2.3.10"
ksp = "2.3.6"
google-dagger = "2.59.2"

We have an Android library module that supports our :app module. Both of these modules are configured to have flavors to allow us to produce different builds. A common pattern is to declare an interface in a common directory: /main and implement this differently in flavor-specific directories to change the app's behaviour based on build flavor selected.

If we choose to satisfy the dependency with an implementation defined in /main we do not see an issue and are able to successfully compile.

However, we have noticed providing an implementation from a flavor directory (e.g /myFlavorDebug) produces the following error:

> Task :support:kspDevCompleteDebugKotlin FAILED
e: [ksp] ModuleProcessingStep was unable to process 'com.zaptec.test.support.SupportModule' because 'MyClass' could not be resolved.

Dependency trace:
    => element (CLASS): com.zaptec.test.support.SupportModule
    => element (METHOD): provideMyInterface(MyClass)
    => element (PARAMETER): mClass
    => type (ERROR parameter type): MyClass

If type 'MyClass' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'MyClass' is on your classpath.
e: [ksp] BindingMethodProcessingStep was unable to process 'provideMyInterface(MyClass)' because 'MyClass' could not be resolved.

Dependency trace:
    => element (CLASS): com.zaptec.test.support.SupportModule
    => element (METHOD): provideMyInterface(MyClass)
    => element (PARAMETER): mClass
    => type (ERROR parameter type): MyClass

If type 'MyClass' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'MyClass' is on your classpath.

FAILURE: Build failed with an exception.

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