Josh Eldridge

01/07/2023, 4:23 AM
Has anyone had the shared module cause issues with running instrumented tests via
./gradlew connectedAndroidTest
? I'm getting an error/exception that is not particularly helpful, I'm wondering if something internal is failing? Posting the stacktrace in the thread.

Zac Sweers

01/07/2023, 5:08 AM
This doesn’t have anything to do with kotlin?

Josh Eldridge

01/07/2023, 5:10 AM
It's specifically related to multiplatform
If I run the command only for the presentation module (android) it runs fine as expected. But the shared (Kotlin multiplatform) module is introducing a hidden issue. I don't have any instrumented tests located in that module but my suspicion at the moment is something odd going on with the KMM source sets
Well I was checking the differences between the dependencies of my presentation module and the shared KMM module and adding the espresso dependency is somehow fixing the hidden issue of the KMM module, even though it doesn't actually have any tests to run? Still not entirely sure why it needs the dependency when it doesn't contain any actual instrumented tests that run, but it fixes it 🤷
Copy code
val androidTest by getting {
  dependencies {
Well I found the root issue I believe, I still had a
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
copied over into the android plugin of the shared module, and if I remove that I can also remove the espresso dependency. This allows the instrumented test command to finish successfully, although it does take multiple minutes for it to finish waiting on the shared module with no tests, which is still odd, but I'll take that over an ambiguous error message. So yeah none of this was probably kotlin multiplatform specific, but oh well I learned something new