Landry Norris

02/11/2022, 9:31 PM
I'm writing Compose tests for one of my projects that I recently started. I'm getting an ExceptionInInitializerError that is
caused by java.lang.RuntimeException: Method allowThreadDiskReads in android.os.StrictMode not mocked
. I wrote a simple test (in thread), which reproduced the issue. This only started when I added Compose tests.
class TestClass {
val composetestRule = createComposeRule()
fun simpleTest() {
composeTestRule.setContent {
Text(text = "")
I'm using compose 1.0.1, junit 4.13.2, and kotlin("test-junit") in my build.gradle
The stacktrace points to the setContent line

Albert Chang

02/12/2022, 3:40 AM
Are you putting the test in "androidTest" directory?

Landry Norris

02/12/2022, 4:03 AM
I am
This is a KMM project if that matters