Hey folks. I'm following the pattern of having and...
# multiplatform
j
Hey folks. I'm following the pattern of having androidMain and commonMain target folders in the same module. But getting this warning
Copy code
Function 'getApiName': expect and corresponding actual are declared in the same module, which will be prohibited in Kotlin 2.0. See <https://youtrack.jetbrains.com/issue/KT-55177>
I'm a Kotlin/Gradle noob, so I'm not sure what to do. Does this mean I need an android module and a common module with separate build.gradle files? I'm wondering how the build would connect expects and actuals.
m
I think this warning is because both the expect and the actual are in either
androidMain
or
commonMain
. Either that or you configured your source sets wrong in gradle.
From the ticket, it seems like their choice of module is confusing. They are treating each source set in a gradle module as a module, so you shouldn't need to create a new gradle module. But this comment sounds like someone experienced this bug while using the expect/actual as intended, which I would consider being a bug. https://youtrack.jetbrains.com/issue/KT-55177/Deprecate-declaration-of-expect-and-actual-counterparts-of-same-class-in-one-module#focus=C[…]1888.0-0
j
Thanks for that explanation @Michael Krussel it's very helpful.
e
the terminology around this is a bit overloaded
Gradle terminology is multiple source sets in a project, and multiple projects in a build
the Kotlin compiler operates independently in each Gradle project at a time, and so each source set is a separate module as far as it is concerned
and the IDE calls the whole build a project, and projects modules…
j
Now I don't feel so bad for not being able to figure out precisely what a module is.
@ephemient forgot to thank you for than explanation. thank you, really helpful.