Elijah Dangerfield
11/13/2025, 9:12 PMkotlin-inject-anvil 0.1.6 where @ContributesBinding with multibinding across modules works for Android but not iOS.
My Setup:
• Kotlin 2.2.21, KSP 2.2.21-2.0.4, kotlin-inject-anvil 0.1.6
• Multi-module KMP project (see diagram)
• Using per-target KSP configuration (kspAndroid, kspIosSimulatorArm64, etc.)
What happens:
• Feature modules generate contribution interfaces correctly in amazon.lastmile.inject package for both Android and iOS
• App module's MergeComponentProcessor finds contributions for Android ✅
• App module's MergeComponentProcessor does NOT find contributions for iOS ❌
• Result: KotlinInjectAppComponentMerged is empty for iOS (doesn't extend the contribution interfaces)
Generated code comparison:
Android (works):
interface KotlinInjectAppComponentMerged :
ComDangerfieldAnteFeaturesActivityImplActivityFeatureEntryPoint,
ComDangerfieldAnteFeaturesHomeImplHomeFeatureEntryPoint
iOS (broken):
interface KotlinInjectAppComponentMerged // Empty!
The contribution interfaces ARE generated in the feature modules for iOS, but Resolver.getDeclarationsFromPackage("amazon.lastmile.inject") appears to not see them when processing the app module.
Is this a known limitation with Kotlin 2.2.x/KSP 2.2.x, or is there a specific configuration needed for cross-module contributions in KMP? I noticed the sample uses Kotlin 2.1.21 - Maybe I should downgrade?
Thanks!blakelee
11/13/2025, 10:19 PMElijah Dangerfield
11/13/2025, 10:19 PMElijah Dangerfield
11/13/2025, 11:56 PMAndrew Steinmetz
12/04/2025, 7:35 PMksp.useKSP2=falseblakelee
12/04/2025, 7:36 PM@ContributesTo in commonMain then ksp doesn’t generate the graph for iOSAndrew Steinmetz
12/06/2025, 12:51 AMblakelee
12/06/2025, 12:52 AMcommonMain
@ContributesTo(Appscope::class)
interface MyInterface
I think it’s as simple as that