You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening up this ticket to track after discussion in #4193
With dagger-android KSP support in 2.49, referencing a dagger Module which has an internal @ContributesAndroidInjector method in a @ContributesAndroidInjector(modules = []) annotation in different gradle module will cause the build to fail because it cannot resolve a generated subcomponent class. This setup works using KAPT.
e: [ksp] ComponentProcessingStep was unable to process 'com.example.daggerandroid.ExampleModule_ContributeAppClass$app_debug.AppClassSubcomponent' because '<error>' could not be resolved.
Dependency trace:
=> element (CLASS): com.example.mylibrary.LibraryModule_ContributeLibraryClass$mylibrary_debug
=> annotation type: dagger.Module
=> annotation: @dagger.Module(includes={}, subcomponents={<error>})
=> annotation value (TYPE_ARRAY): subcomponents={<error>}
=> annotation value (TYPE): subcomponents=<error>
If type '<error>' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type '<error>' is on your classpath.
e: Error occurred in KSP, check log for detail
The latest issue your seeing seems to be a bug in KSP (or XProcessing) where it doesn't seem to be able to handle class names that contain $ when referenced from annotations. In this case it affects the class Dagger generates from the @ContributesAndroidInjector annotation:
@Generated
@Module(subcomponents = LibraryModule_ContributeLibraryClass$mylibrary_debug.LibraryClassSubcomponent.class)
public abstract class LibraryModule_ContributeLibraryClass$mylibrary_debug {
...
}
In particular, the LibraryModule_ContributeLibraryClass$mylibrary_debug.LibraryClassSubcomponent type within the annotation is showing up as error type, hence the error message you're seeing.
The text was updated successfully, but these errors were encountered:
wbonnefond
changed the title
[KSP] dagger-android unresolved generate subcomponent for internal methods used across modules
[KSP] dagger-android unresolved generated subcomponent for internal module methods used across gradle modules
Dec 21, 2023
@bcorso looks like this was fixed in the latest version of KSP (1.9.22-1.0.17). Any chance this can be pulled into the next release? It would require updating the kotlin version
Hi @wbonnefond I think you should be able to just upgrade that dependency yourself in your own app (i.e. you control the Kotlin and KSP version). If that doesn't work for you let us know (along with any details why it didn't work).
Opening up this ticket to track after discussion in #4193
With dagger-android KSP support in 2.49, referencing a dagger Module which has an internal
@ContributesAndroidInjector
method in a@ContributesAndroidInjector(modules = [])
annotation in different gradle module will cause the build to fail because it cannot resolve a generated subcomponent class. This setup works using KAPT.I have added a reproducer project here: https://github.com/wbonnefond/DaggerAndroidKspError
In the previous discussion @bcorso had said:
The text was updated successfully, but these errors were encountered: