Oluwafemi Ogundipe
04/10/2023, 10:50 AMKotlinSourceSet with name 'androidUnitTest' not found.
Here is my configuration, please what am I missing?
plugins {
kotlin(Plugins.multiplatform)
kotlin(Plugins.nativeCocoapods)
id(Plugins.androidLibrary) version Versions.androidGradlePlugin
id(Plugins.ktlint) version Versions.ktlintVersion
id(Plugins.kotlinx_serialization)
id("io.kotest.multiplatform") version "5.0.2"
}
kotlin {
android {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
targets {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
android {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
iosX64()
}
android()
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "14.1"
framework {
baseName = "magicsdk"
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(Google.gson)
// ktor
implementation(Ktor.clientSerialization)
implementation(Ktor.serialization_kotlinx)
implementation(Ktor.ktor_json_serialization)
implementation(Ktor.content_negotiation)
implementation(Ktor.core)
implementation(Ktor.kmmLogging)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation("io.kotest:kotest-framework-engine:5.0.2")
// implementation("io.kotest:kotest-assertions-core:5.0.2")
}
}
val androidMain by getting {
dependencies {
implementation(Ktor.android)
implementation(Ktor.ktor_client_android_okhttp)
implementation(SQLDelight.androidDriver)
implementation(Ktor.logging)
}
}
val androidUnitTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13.2")
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
dependencies {
implementation(Ktor.ktor_darwin)
implementation(Ktor.ios)
implementation(SQLDelight.nativeDriver)
}
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
}
android {
namespace = "com.tilbury.magic"
compileSdk = Application.compileSdk
defaultConfig {
minSdk = Application.minSdk
targetSdk = Application.targetSdk
}
}
atyrin
04/10/2023, 11:36 AMkotlin.mpp.androidSourceSetLayoutVersion=2
to your gradle.properties
?
androidUnitTest
is available only in the new layout.
https://kotlinlang.org/docs/whatsnew18.html#kotlin-multiplatform-a-new-android-source-set-layoutOluwafemi Ogundipe
04/10/2023, 11:46 AM#Gradle
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
#Kotlin
kotlin.code.style=official
#Android
android.useAndroidX=true
android.nonTransitiveRClass=true
#MPP
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.androidSourceSetLayoutVersion=2
Oluwafemi Ogundipe
04/10/2023, 11:47 AMatyrin
04/10/2023, 12:02 PMJeff Lockhart
04/10/2023, 3:12 PMandroid { ... }
and android()
.Jeff Lockhart
04/10/2023, 3:14 PMiosX64()
is called twice.Jeff Lockhart
04/10/2023, 3:16 PMkotlin {
and android()
with jvmToolchain(8)
, as that seems to be your goal with those lines.atyrin
05/04/2023, 1:40 PM