EACCES (Permission denied) launchImageGallery Android

Description

I am testing with my OnePlus 6 and tried picking the same image with all my suggested apps (OnePlus’ gallery app & Google Photos). Rendering only functions properly for the Google Photos’ attempt.
I have tested with both storage-permission enabled & disabled, both give same result.
Manifest includes WRITE_EXTERNAL_STORAGE.
Things work as expected for launchCamera() with same options.

Error:
nativeEvent: error: "/storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20201104-WA0003.jpg: open failed: EACCES (Permission denied)

It does not have anything to do with the space in the pathname. Other attempt: /storage/emulated/0/DCIM/Camera/IMG_20201024_233443.jpg: open failed: EACCES (Permission denied)

Component-state:

imageSource:
0:
  fileName:"IMG-20201104-WA0003.jpg"
  fileSize:129868
  height:805
  type:"image/jpeg"
  uri:"content://media/external/images/media/152634"
  width:580
1:
  fileName:"IMG-20201104-WA0003.jpg"
  fileSize:129868
  height:805
  type:"image/jpeg"
  uri:"content://com.google.android.apps.photos.contentprovider/0/1/content%%3A%%2F%%2Fmedia%%2Fexternal%%2Fimages%%2Fmedia%%2F152634/ORIGINAL/NONE/image%%2Fjpeg/1086794781"
  width:580

How to repeat issue and example

  • Launch image library picker:
launchImageLibrary(
  {
    mediaType: "photo"
  },
  (response: ImagePickerResponse) => {
    this.processImageReponse(response);
  }
);
<Image
  style={{
    height: 90,
    width: 120,
    backgroundColor: "#ccc"
  }}
  source={{ uri: item.uri }}
  onLoadEnd={() => console.warn("onLoadEnd")}
  fadeDuration={0}
  onError={e => {
    e.persist();
    console.error("Error loading marker image", e);
  }}
/>

Additional Information

  • Image Picker version: 3.0.0-vnext.3
  • React Native version: 0.61.5
  • Platform: Android API 29
  • Development Operating System: MacOS
  • Android SDK Platfom-tools: 30.0.4
  • Android SDK Tools: 26.1.1

1 possible answer(s) on “EACCES (Permission denied) launchImageGallery Android