I created an androidCommonTest source set to share...
# multiplatform
j
I created an androidCommonTest source set to share code between androidTest unit and androidAndroidTest instrumented tests. The change works as expected if I run the tests in the terminal, but it breaks the gradle sync in Android Studio, which fails with the error:
Key androidCommonTest is missing in the map.
There's no stack trace or further error info, unfortunately. In fact, the top-level build log completes with
BUILD SUCCESSFUL
. So it's unclear how to troubleshoot this. This is the build.gradle.kts change I made:
Copy code
kotlin {
  ...
  sourceSets {
    ...
    val commonTest by getting {
      ...
    }
    val androidCommonTest by creating {
      dependsOn(commonTest)
    }
    val androidTest by getting {
      dependsOn(androidCommonTest)
      ...
    }
    val androidAndroidTest by getting {
      dependsOn(androidCommonTest)
      ...
    }
  }
}
Looks like this issue is specific to Android Studio Dolphin. I don't get the error in Chipmunk, or IntelliJ IDEA. I filed an issue for it with Google.
r
Check which Java is used by your system and which one is used by Android Studio. Try setting the same and see if now it is consistent (in failing or working correctly).
j
Android Studio is using its embedded JDK 11. On the terminal my system JDK is 11 as well. Dolphin's JDK is 11.0.13 vs Chipmunk, IntelliJ, and my system's are 11.0.12 is all. I switched AS Dolphin to use the system JDK and still get the error.