Thread
#multiplatform
    mbonnin

    mbonnin

    2 years ago
    Can I have a regular "android" module depend on a "multiplatform" module (with a jvm target) using something like
    implementation(project("lib"))
    ? That doesn't seem to work.
    Kris Wong

    Kris Wong

    2 years ago
    i would not expect that to work. an Android target, maybe, but not a JVM target
    i don't know enough of the Gradle and Android Gradle plugin internals to say with certainty, though
    mbonnin

    mbonnin

    2 years ago
    Can I add an android target to my lib module without having to duplicate too much of my
    expect
    code ?
    ian.shaun.thomas

    ian.shaun.thomas

    2 years ago
    the problem with adding an android variant is if anyone wants to write some common jvm code based on your lib then use that code in their android project alongside your android lib they have an immediate issue. you can see in that project I took a pretty awkward step to build the core module, then android, then package them together for deployment so you can have jvm code and the android code in the same consumer project without consequence. I think if I did it again I would just have android as a totally separate implementation
    Kris Wong

    Kris Wong

    2 years ago
    i would expect a project dependency to work with 2 KMP modules. but not a project KMP dependency in a standard android project
    i don't know how it would find the target file it needs in the KMP targets
    mbonnin

    mbonnin

    2 years ago
    @ian.shaun.thomas that worked like a charm👌🏽 . I added the multiplatform plugin and put everything in
    androidMain
    and it looks like it's working well. So @Kris Wong was right too that a regular android project would most likely not work.
    ian.shaun.thomas

    ian.shaun.thomas

    2 years ago
    Yep, I forgot that the android module has the mpp plugin. That is indeed likely why it works. 👍
    Javier

    Javier

    2 years ago
    Android can depend of jvm module too I think
    ian.shaun.thomas

    ian.shaun.thomas

    2 years ago
    most likely yeah that should work specifying the.. classifier?
    Javier

    Javier

    2 years ago
    Mmm I have to try, because in my original multiplatform module, the Android Target is using jvm too so I don't know what happen if Android didn't use jvm and you don't set the classifier. Hope it adds both, JVM and Android