Thread
#multiplatform
    Robert Munro

    Robert Munro

    1 year ago
    i have a
    jvmMain
    and an
    androidMain
    source folder in my shared module. It seems like l have to duplicate the actual class declaration in both jvmMain and androidMain as if I just have the jvm version the expected class says something like "there isnt an actual declaration for jvm" (referring to androidMain). If i delete my android source set and gradle declaration the shared library complains about a missing
    AndroidManifest.xml
    . So just wondering if it is normal that i would have to duplicate
    androidMain
    and
    jvmMain
    s

    Sourabh Rawat

    1 year ago
    Maybe try making androidMain depend on jvmMain
    Robert Munro

    Robert Munro

    1 year ago
    I ont guess you have any tips on how to do it for kts? For gradle i do
    sourceSets {
    test {
        java.srcDir 'src/sharedTest/java'
    }
    }
    but there seems to be no srcDir function for kts
    s

    Sourabh Rawat

    1 year ago
    dependsOn(jvmMain)
    in the
    androidMain
    is how you normally make dependent sourcesets.
    Robert Munro

    Robert Munro

    1 year ago
    yes that works a treat .. thanks 🙂
    s

    Sourabh Rawat

    1 year ago
    Did it solve the expect/actual issue you were facing?
    Javier

    Javier

    1 year ago
    another approach if you dont want to share all jvm, is having a folder called something like androidAndJvm and add it to both sourcesets (you can see this approach in compose-jb samples)
    Robert Munro

    Robert Munro

    1 year ago
    @Sourabh Rawat yes it worked thanks
    @Javier thanks good to know ... actually all my classes are the same atm but that would be better