I’m having an issue where I have two kmp modules, ...
# multiplatform
p
I’m having an issue where I have two kmp modules, one depends on the other, but the later doesn’t see the code in the first module. I’ve tried so far: • Adding a package to
authService
• Removing the two targets on the consumer module (
prod
and
dev
normally) • Adding the relevant targets to the imported module to match that of the consumer None of these seem to work, so I’m a bit lost to what I may be doing wrong 🙃 Anyone had a similar issue before?
PS, it’s not an IDE issue as the same error happens when running the app from command line
m
Try adding the import manually?
p
Yeah, for now I've ended up making it a plain jvm module and that seems to be ok. I'll have to find a different way to load Dev/prod config 😅 not the end of the world
m
Yea, I think different compilations is the new way to go
💯 1
p
Yeah, although, we don't get the expect/actual options that multiple targets offer, do we?
m
I don't think so 😞
p
And the IDE seemed very confused about having multiple compilations 🙃 but we'll get there 🤞
The lack of expected can probably be resolved with an interface and multiple implementations on each compilation with the same name (as it's possible with AGP). Just need that lovely IDE support 😅
*actually, we don't need the interface in that scenario
m
Was able to get
expect
working actually using a manual sourceSet: https://github.com/martinbonnin/test-compilations/blob/main/build.gradle.kts
The weirdest thing is that it doesn't recognize "println" 🤷
😅 1
But expect/actual is working fine in different jvm compilations
p
Oh, that’s good to hear. I’ll try that 🙂
👍 1
c
I'm not sure, but it looks to me like
AuthService.kt
has no
package
declaration? If so, that's why—you can't import things from the default package.
p
@CLOVIS It works without a package on jvm. Also, one of the things I said I tried was adding a package. But thanks for the suggestion.
c
Ah, sorry. Is it published anywhere? I have a lot of multi-project KMP repositories, so I'm sure it's possible, but I don't see what the difference is
p
Not public yet. But I'll see if I can replicate it independently 🤞
m
Was able to get
expect
working actually using a manual sourceSet
Welp, that doesn't work 😞 . I just realized it outputs a big warning:
Copy code
w: Following Kotlin Source Set groups can't depend on 'jvmCommon' together as they belong to different Kotlin Source Set Trees.
Source Sets from 'dev' Tree:
  * 'jvmDev'
Source Sets from 'prod' Tree:
  * 'jvmProd'
sad panda 1
I left a message here