https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

rob42

04/02/2024, 5:34 PM
Is "Main.kt" special cased at all? I'm experiencing magic behaviour. I have a multiplatform module (imported by desktop and android). Any functions defined in
mymodule/src/commonMain/kotlin/Main.kt
become an "Unresolved reference" when called from my compose desktop target, but not when called from android. This has sent me on a wild goose chase until I realised that if I name the file anything else, the functions are importable.
e

ephemient

04/02/2024, 5:37 PM
it is not special but if you have another file with the same name (that isn't renamed with
@file:JvmName
), only one will be visible on JVM (and Android)
eg if you have a Main.kt in both common and desktop but not android source set then you would get those symptoms
r

rob42

04/02/2024, 5:38 PM
I have no other main.kt files in the multiplatform module
But I do in the compose app module
e

ephemient

04/02/2024, 5:38 PM
that'll do
r

rob42

04/02/2024, 5:39 PM
Oh man, thanks for clarifying
e

ephemient

04/02/2024, 5:39 PM
use different packages for different modules
r

rob42

04/02/2024, 5:45 PM
ahh, make sense. thank you!