I am not able to load files using File() from <jav...
# multiplatform
m
I am not able to load files using File() from java.io in my kotlin multiplatform project. It compiles fine but when I include the build .aar file in my android project, it gives no such directory exists error. Is it not possible to load a file in a KMP project?
c
A “no such directory exists” error indicates that the File apis are working fine. It’s just that the file cannot be found. How are you loading the file? On Android, pretty much all file operations need to be relative to
context.cacheDir
or
context.filesDir
for security reasons https://developer.android.com/training/data-storage/app-specific
m
I was loading the file in kotlin multiplatform library, not android. But hey, I solved the issue by passing the filedescriptor from my android project to KMP.