When trying to add import from child module to test in commonTest dependency cannot be found.
Example. Module base has class BaseTest in commonTest . Module shared has dependency to base in gradle inside of commonMain sourceSet. Module share has class Test in commonTest. When trying to import BaseTest dependency cannot be found.
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
}
version = "1.0"
kotlin {
android()
iosX64()
sourceSets {
val commonMain by getting {
dependencies {
implementation(project(":base"))
}
}
val commonTest by getting {
dependsOn(commonMain)
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting
val androidTest by getting
val iosMain by creating {
dependsOn(commonMain)
}
val iosTest by creating {
dependsOn(commonTest)
}
}
}
android {
compileSdk = 32
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 26
targetSdk = 32
}
}
package com.example.myapplication
import com.example.base.Base
import kotlin.test.Test
class Test {
@Test
fun test() {
Base()
BaseTest()
}
}
How can I get access to child test classes in child module?