I believe I have come up with a solution to this question here. Though, I’ve not been able to test it, yet. I’m following this guide to setup custom modules setup so that my platform (Android/iOS) specific sourceSet code gets picked up.
I believe I have everything set correctly as I can KSP generated code in the
commonMain/
sourceSet. The concern I have is that “native” component scanning doesn’t seem to work. Reviewing the
androidMain/
generated code I don’t see Koin declarations for classes I’ve marked with`@Single` . The generated module for
code to generate a module graph using the Assemble Build menu option. The issue I was having was related too using the same
@ComponentScan(MY_PACKAGE_PATH)
in
commonMain/
and
androidMain/
sourceSets. It appears that using the same path in the main source set will “prevent” the target source set from running.
The
iOSMain/
generated module graph for me only when launching on a simulator/physical iOS device. Is this intentional?
a
arnaud.giuliani
09/10/2025, 3:32 PM
in last versions (2.1.1 & 2.2.0) you can use @ComponentScan in one side only: either you want to scan for commonMain components (with their actual definitions in android/iOS) either you a expect/actual module, to run @ComponentScan on each native side
j
Jonathan
09/10/2025, 3:34 PM
That matches the behavior I saw last night… Can you confirm my suspension about the