While I do not know much about Android, I do know it is Linux-based and in Linux this: /app/main/src/res/assets/scripts/truite.rive
is an absolute path starting from system’s root directory.
Have you tried a relative path: app/main/src/res/assets/scripts/truite.rive
or an absolute path: app_installation_dir/app/main/src/res/assets/scripts/truite.rive
?
ok i have corrected this
but where am i when using assets.open ? in the assets folder ?
i still have the FileNotFoundException with =>
val afile = assets.open( “/scripts/truite.rive” )
The path is relative to the “assets” folder, so you have to leave off the initial slash. In other words, to access this file…
"/app/main/src/res/assets/scripts/truite.rive"
…you would use…
assets.open("scripts/truite.rive")
However, you should be aware that if you use the external storage directory on Android, you will have to request permission to access it from the user, otherwise on recent Android versions, your app will crash when it tries to access it.
A better way, if you need to put the file somewhere you can get an actual path to it, would be to use your app’s cache directory. That way Android OS can delete it if the phone is low on space, but your app can recreate it when necessary when it runs. For example…