spierce7

    spierce7

    2 years ago
    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
    Kris Wong

    Kris Wong

    2 years ago
    how have you configured your source sets?
    spierce7

    spierce7

    2 years ago
    Here is my gradle.kts file:
    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

    2 years ago
    Interesting when I changed my kotlin plugin to `
    1.3.70
    the workaround started to work. Now I need to wait till one of my dependencies gets republished with that kotlin version 🙂
    Artyom Degtyarev [JB]

    Artyom Degtyarev [JB]

    2 years ago
    Hi, @spierce7! Try to set this Gradle property in your project:
    kotlin.mpp.enableGranularSourceSetsMetadata=true
    The same problem as here. Also, are you using the same Gradle-IDEA-Kotlin versions as listed in this ticket?
    spierce7

    spierce7

    2 years ago
    I’ll give that a shot. Thanks