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

rmyhal

03/02/2021, 12:39 PM
Hello, what could be the problem that I see only
ios
and
iosX64
configurations for running tests for
commonTest
and don’t see android?. Project has two targets: android & ios. Thanks. gradle config:
Copy code
plugins {
    kotlin("multiplatform")
    id("com.android.library")
}

kotlin {
    android()
    ios {
        binaries {
            framework {
                baseName = "shared"
            }
        }
    }
    val isiOSDevice = System.getenv("SDK_NAME").orEmpty().startsWith("iphoneos")
    if (isiOSDevice) {
        iosArm64("ios")
    } else {
        iosX64("ios")
    }
    sourceSets {
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
    }

    explicitApi()
}

android {
    compileSdkVersion(30)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdkVersion(23)
        targetSdkVersion(30)
    }
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
t

Thomas Myrden

03/02/2021, 12:45 PM
Copy code
if (isiOSDevice) {
        iosArm64("ios")
    } else {
        iosX64("ios")
    }
r

russhwolf

03/02/2021, 2:17 PM
It’s a longstanding bug which is fixed in newer IDEA versions and in the most recent AS canary versions. I don’t think it’s made it to AS stable yet.
👍 1
k

Kris Wong

03/02/2021, 2:37 PM
to my knowledge the KMM plugin only supports running tests on iOS devices. also, unrelated, you are declaring your iOS targets twice.
once in the
ios
block, and once in the block below that
so you'll have iosArm64, iosX64, and ios
👍 1
r

rmyhal

03/03/2021, 10:09 AM
thanks! Checked on AS beta 5 and now I see
androidUnitTest
and
ios