https://kotlinlang.org logo
Title
s

Sam

03/21/2023, 12:55 AM
I'm trying to set up some unit tests in my KMM project and for some reason Android Studio just won't acknowledge the existence of the
commonTest
sourceset. I created the folder structure for it, and the Gradle config has
val commonTest by getting { ... }
and dependencies I list there get downloaded but IDE functionality doesn't work at all in the folder. No imports, everything is red.
commonTest
wasn't in the list of suggestions when I created the folder. Anyone experienced this? I used the template that comes with AS.
IDK if it's related, but since I first created the project from the template, only the Android sourceset actually gets marked as source code. If I manually mark the others as source roots they get un-marked as soon as Gradle syncs. The
commonMain
and
iosMain
folders work just fine though. It's just mildly annoying since I don't get package folding, etc.
Aha... For some reason it's if I add any Kotest dependencies to
commonTest
, it actually breaks every sourceset other than Android (I hadn't noticed the others were broken because the tabs were already opened and I guess just kept the syntax highlighting from before). Well that's... frustrating?
I guess I'll follow up in #kotest
Issue ended up being that
kotest-common-iosx64:5.5.5
is missing the actual
.klib
file in Maven Central. The version is published but the file is missing. Solution for now is using 5.5.4 instead.
For some reason this was only being logged as a warning and not actually failing Gradle sync, despite breaking 2/3 of the project. So Android Studio didn't feel it necessary to show any UI indication that there had been a problem...