https://kotlinlang.org logo
s

savrov

05/10/2020, 4:38 PM
in continue of: https://kotlinlang.slack.com/archives/C3PQML5NU/p1589125830414200 I did the changes, so both modules are MPP now. I have to mention, that project structure is a bit more difficult, that just 2 models. I’m trying to combine Clean Architecture with MPP.  Priject structure is: • config (“pure-kotlin”) • domain (“pure-kotlin”) • data (“pure-kotlin”) • infrastructure (mpp module with android, jvm support) • utils (“pure-kotlin”) But as @Joffrey all these modules are MPP (with android and jvm support). And that’s a place where i got stuck. My
:config
has a dependency on
:utils
and buring build phase this dependency fails on
Cannot choose between the following variants of project :utils:....
.  I think that the reason is in defining targets in
build.gradle
files (every module have the same):
Copy code
jvm('backend') 
jvm('android')
So compiler does not know what to do. Neither me. =( If you have some thoughts or ideas how to solve this, please share, thank you
u

Ugi

05/10/2020, 5:24 PM
If I understood correctly, and your library is pure kotlin, then you shouldn't need to have two jvm targets, as you can just use the default one on android.
so just
Copy code
jvm('backend')
And then in your
infrastructure
project, where you want to use android specific stuff, you would use something like:
Copy code
jvm()
android()
s

savrov

05/10/2020, 6:30 PM
yeah, it works! Thank you