I have a project in Android Studio with androidApp...
# multiplatform
s
I have a project in Android Studio with androidApp, iosApp modules and three additional multiplatform modules. The original build.gradle.kts files were generated from the new project wizard from 1.4-M3. Lets call the three multiplatform modules mp1, mp2, and mp3 (not their real names :-)). If I make a valid unit test class names FooTest in the test directory of mp1 and attempt to debug it, Android Studio issues a gradle task "mp1:assemble", waits for that to build, then runs the debugger, The debugger then fails to start with a NoClassDefFound exception because FooTest is not compiled yet. If I then go to the gradle window, force run gradle task "mp1compileDebugUnitTestSources", it correctly builds the unit test, and the debugger then starts successfully. This is my first multi platform project. Do others see this behavior regarding debugging of unit tests? Whatever gradle build task is issued when debugging a unit test, seems like it should somehow tell gradle to ensure the compileDebugUnitTestSources is run. I've been working around this for a few days and still catch myself forgetting to manually run compileDebugUnitTestSources after a test source change, and then debbugging against mismatched source.
Have since upgraded all related stuff in the project to 1.4.0-rc, and this behavior is still there
As a hack I tried this today and it works around the problem if I add it to each multi-platform build.gradle.kts:
Copy code
project.afterEvaluate {
    val moduleName = this.name.substring(0, 1).capitalize() + this.name.substring(1)
    tasks.getByName("compileDebugSources").finalizedBy("compileDebugUnitTestKotlin$moduleName")}
But I don't understand why I have to do this...