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

spierce7

03/11/2020, 6:31 PM
When using the
ios
platform target for multiplatform, is it possible to get rid of this error when placing actual declarations in the
Platform
file?
Object ‘Platform’ has several compatible actual declarations in modules ab-testing-firebase.client.iosArm64Main, ab-testing-firebase.client.iosMain
Object ‘Platform’ has several compatible actual declarations in modules ab-testing-firebase.client.iosX64Main, ab-testing-firebase.client.iosMain
k

Kris Wong

03/11/2020, 6:35 PM
how have you configured your source sets?
s

spierce7

03/11/2020, 7:10 PM
Here is my gradle.kts file:
Copy code
plugins {
    id("com.android.library")
    kotlin("multiplatform")
//    id("kotlinx-atomicfu")
}

android {
    compileSdkVersion(AndroidConfig.compileSdkVersion)

    defaultConfig {
        minSdkVersion(AndroidConfig.minSdkVersion)
        targetSdkVersion(AndroidConfig.targetSdkVersion)
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
    }
}

kotlin {
    android {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
        publishAllLibraryVariants()
    }
    js {
        browser()
    }
    ios()

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(Deps.kotlin.stdlib.common)

                implementation(Deps.kotlinx.coroutines.common)
                implementation(Deps.rally.store)

                implementation(Deps.ktor.client.common)
                implementation(Deps.ktor.feature.serialization.common)
                implementation(Deps.kotlinx.atomicfu.common)
            }
        }

        val commonTest by getting {
            dependencies {
                for (lib in Deps.kotlin.test.common) {
                    implementation(lib)
                }
            }
        }

        val androidMain by getting {
            dependencies {
                implementation(Deps.kotlin.stdlib.jvm)
                implementation(Deps.kotlinx.coroutines.jvm)

                implementation(Deps.ktor.client.jvm)
                implementation(Deps.ktor.feature.serialization.jvm)
            }
        }

        val androidTest by getting {
            dependencies {
                implementation(Deps.kotlin.test.jvm)
            }
        }

        val jsMain by getting {
            dependencies {
                implementation(Deps.kotlin.stdlib.js)
                implementation(Deps.kotlinx.coroutines.js)

                implementation(Deps.ktor.client.js)
                implementation(Deps.ktor.feature.serialization.js)
            }
        }

        val jsTest by getting {
            dependencies {
                implementation(Deps.kotlin.test.js)
            }
        }

        val iosMain by getting {
            dependencies {
                implementation(Deps.kotlinx.coroutines.ios)

                implementation(Deps.ktor.client.ios)
                implementation(Deps.ktor.feature.serialization.native)
            }
        }

        val iosTest by getting {
        }

        all {
            languageSettings.enableLanguageFeature("InlineClasses")
        }
    }
}
f

fkrauthan

03/11/2020, 10:04 PM
Interesting when I changed my kotlin plugin to `
Copy code
1.3.70
the workaround started to work. Now I need to wait till one of my dependencies gets republished with that kotlin version 🙂
a

Artyom Degtyarev [JB]

03/12/2020, 6:42 AM
Hi, @spierce7! Try to set this Gradle property in your project:
Copy code
kotlin.mpp.enableGranularSourceSetsMetadata=true
The same problem as here. Also, are you using the same Gradle-IDEA-Kotlin versions as listed in this ticket?
s

spierce7

03/12/2020, 3:17 PM
I’ll give that a shot. Thanks
4 Views