This message was deleted.
# community-support
s
This message was deleted.
c
how is the test getting the resource?
j
I think the problem is related to KMP, I moved everything from
jvmAndAndroid
to
jvm
and it is working. Maybe
resources
dir is not being shared there. I will take a look To get the resources I am using:
Copy code
Thread.currentThread().contextClassLoader.getResource(name)?.file?.let(::File)
c
its also possible that resources don’t have a file representation if they are packaged in a jar
j
you mean the android part more than the
jvmAndAndroid
source set?
I can try to copy and paste it to android target
c
any use of resources from the classpath - there’s no guarantee of a backing file. cleanest to process those using the inputstream.
j
yeap, it is the android one which is causing the issue
using inputstream would work on android too?
c
yes
j
well, technically that would mean coping the file to a different place
I think for my use case it has no sense to get this functionality on Android, thank you, I TIL 🙂
👍 1
e
resources do exist on Android, but you never have any guarantee that they're backed by
File
also even though they work, you should use Android's built-in assets instead of resources, as the former are packaged in a way that allows them to be read efficiently from the APK, while the latter cause https://blog.danlew.net/2013/08/20/joda_time_s_memory_issue_in_android/
👍 2
thank you 1