louiscad
03/07/2019, 12:51 AMandroidMain sourceSet from Kotlin multiplatform plugin in an androidTest sourceSet (instrumented test)?
My build.gradle.kts includes the following:
android {
setDefaults()
sourceSets.getByName("androidTest").java.srcDir("src/androidInstrumentedTest/kotlin") // I put my instrumented tests here.
}
kotlin {
android()
sourceSets {
getByName("androidMain").dependencies {
// Some dependencies here
}
}
}
dependencies {
androidTestImplementation(Libs.kotlin.testJunit)
androidTestImplementation(Libs.androidX.test.coreKtx)
androidTestImplementation(Libs.androidX.test.ext.junit)
androidTestImplementation(Libs.androidX.test.runner)
androidTestImplementation(Libs.kotlinX.coroutines.android)
}
The problem I encounter is that it compiles, but when an instrumented test is run, there's NoClassDefFoundError on anything defined in androidMain (be it source or dependency).
Note that the IDE shows no warning and allows me to use the dependencies from androidInstrumentedTest , but it fails at runtime.gildor
03/07/2019, 1:59 AMnestserau
03/07/2019, 1:39 PM