https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

Ruben Quadros

03/03/2024, 7:02 PM
Hey everyone! How can I read json file from
commonTest
in
androidTest
? I am able to read it in
jvmTest
via this snippet:
Copy code
internal actual fun readResource(resourceName: String): String {
    return ClassLoader.getSystemResourceAsStream(resourceName).use { stream ->
        InputStreamReader(stream!!).use { reader ->
            reader.readText()
        }
    }
}
m

mbonnin

03/03/2024, 7:19 PM
If you're in
commonTest
you can use okio
r

Ruben Quadros

03/04/2024, 4:41 AM
Thank you! I'm able to read it via
FileSystem
2 Views