Thread
#multiplatform
    b

    benkuly

    1 year ago
    Is it possible to use the same code for jvmMain and androidMain but with slightly different dependencies? This does not work, because then jna classes are duplicated:
    val jvmMain by getting {
        dependencies {
            implementation("net.java.dev.jna:jna:${Versions.jna}")
        }
    }
    val androidMain by getting {
        dependsOn(jvmMain)
        dependencies {
            implementation("net.java.dev.jna:jna:${Versions.jna}@aar")
        }
    }
    russhwolf

    russhwolf

    1 year ago
    You could try something like
    val jvmAndAndroidMain by creating
    val jvmMain by getting {
        dependsOn(jvmAndAndroidMain)
        dependencies {
            implementation("net.java.dev.jna:jna:${Versions.jna}")
        }
    }
    val androidMain by getting {
        dependsOn(jvmAndAndroidMain)
        dependencies {
            implementation("net.java.dev.jna:jna:${Versions.jna}@aar")
        }
    }
    IDE support for this is not always great though, and you might need to manually wire some expect/actual declarations depending on how the rest of your project is configured.
    b

    benkuly

    1 year ago
    I already tried that, but jmvAndAndroidMain contains JNA dependencies, so it does not compile.