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

Javier

11/30/2020, 3:07 PM
I have a jvm module which is implementing a kotlin multiplatform module that only have jvmMain target. The build is working perfectly and all tests pass. But if I go to some file inside the jvm module, I see that all referecences from jvm multiplatform module are unresolved, anyone know why this is happening?
m

Mustafa Ozhan

11/30/2020, 3:14 PM
It is a known bug if you have also Android target in your project
👍 2
https://kotlinlang.org/roadmap.html
Copy code
Sharing code between JVM and Android
j

Javier

11/30/2020, 3:19 PM
Yeap, we have an app module which implements this multiplatform module. It is working there fine indeed
m

Mustafa Ozhan

11/30/2020, 3:19 PM
yes exactly, IDE will give error but if you run your task with command line you will see that it will work
j

Javier

11/30/2020, 3:21 PM
But this is not going to be fixed until 1.5 (march)? The development in this state is impossible. The only solution is to migrate all jvm modules to multiplatform modules with only jvm targets?
m

Mustafa Ozhan

11/30/2020, 3:24 PM
Well I am not right person to answer this, probably someone from JB can answer this, it is slowing down my progress also but not impossible
👍 1
j

Javier

11/30/2020, 3:29 PM
implementing multiplatform in another multiplatform (only with jvm targets) have this problem too?
Is there any youtrack issue where this is redacted?
Changing the jvm module that implements the multiplatform module to android module is working fine
m

mbonnin

11/30/2020, 4:04 PM
Would be nice to have an issue on youtrack as well
To workaround, I set a custom gradle property in my ~/.gradle and use that to remove Android portions
r

russhwolf

11/30/2020, 4:12 PM
For youtrack issues, https://youtrack.jetbrains.com/issue/KT-29082 is related. I thought there was a better one but I'm having trouble finding it off-hand, so maybe it's worth logging something. I think it probably belongs more on the JetBrains side than the Google side but 🤷
2
j

Javier

11/30/2020, 4:26 PM
yep, with android modules it is working perfectly, so it is more related to JetBrains JVM kotlin plugin
s

solidogen

12/04/2020, 12:34 PM
@mbonnin how exactly do you proceed with disabling android module? I tried: • commenting out include(“:android”) app module from settings • commenting out id(“com.android.library”) in common module plugins dsl • commenting out androidMain and androidTest sources sets in sourceSets dsl • commenting out android() in kotlin dsl in common module • commenting out android block dsl in common module • commenting out whole build.gradle.kts in android app module Still, I can’t get my jvm module to recognize commonMain classes
j

Javier

12/04/2020, 12:40 PM
I didn't disabled it. Converting JVM module to android module let intellij to recognize the common classes
i find no way to fix it with JVM
m

mbonnin

12/04/2020, 1:15 PM
commenting out include(“:android”) app module from settings
That's what I would have done
Still, I can’t get my jvm module to recognize commonMain classes
That sucks. Can you upload a small reproducer somewhere? It might be another bug
s

solidogen

12/04/2020, 1:53 PM
Ok I got it. Steps I performed are okay, but to work on JVM app module, I have to switch from Android Studio to IntelliJ, add when error pops, I need to apply an IDE suggestion - add dependency on common.commonMain. Then classes get resolved correctly.
👍 1
j

Javier

12/05/2020, 5:42 PM
well the problem is “solved” if I just remove from
settings.gradle.kts
the jvm module or the android application module
I can’t have both at same time
I think AGP
7.0.0-alpha02
fix this problem (maybe
01
too, I haven’t tried). The problem is you need to use Android Studio Canary, should be great that Google adds a flag to allow using new version on old IDEs