samsung – Android 11 “raw/:storage/…” file paths

Hello Android community!

I am trying to recreate a way of putting a file on my emulator in a location, so that when picked it produces the following uri: “raw/:storage/…”

My challenge right now is I do not have a reproducible way of doing this. I have only gotten this raw uri once in my testing and can’t anymore.

This is react native app, and we’re using a forked version of image-crop-picker library.

Function: https://github.com/aarongrider/react-native-image-crop-picker/blob/master/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java#L369

This is the function that returns the uri of the selected file: https://github.com/aarongrider/react-native-image-crop-picker/blob/master/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java#L672

We’re getting the following error from line 691 probably:
enter image description here

from calling the resolvePath which has a specific way of resolving the uri for Android API 19 and above: https://github.com/aarongrider/react-native-image-crop-picker/blob/master/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java#L546

I am a complete newbie with Android, and just need a consistent way of producing the raw/:storage/.. file uris. I appreciate any guidance provided here! Thanks :]