Unable to read image asset uri in published app

Please provide the following:

  1. SDK Version:41
  2. Platforms(Android/iOS/web/all): Android

Im using Image.resolveAssetSource() to get a imported image asset uri, in local development env its working and returns something like

file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540adcr%252Fcell-counter/ExponentAsset-0cb836e736f4b116715cf3193823f93e.png

but in a published app env its returning a error whe i try to read the uri with readAsStringAsync
Location ‘file:///data/user/0/host.exp.exponent/files/.expo-internal/c987193e5c0e5820c674dc5951bcbbdf.png’ isn’t readable.

this is my sample code:

import { Image } from 'react-native';
import * as FileSystem from 'expo-file-system';

import image1 from 'assets/images/image1.png';
import image2 from 'assets/images/image3.png';
import image3 from 'assets/images/image2.png';

const itemsAssets = {
  item1: {
    name: 'test',
    img: image1,
  },
  item2: {
    name: 'test2',
    img: image1,
  },
  item3: {
    name: 'test3',
    img: image3,
  },
};

const parsedBase64Images = {};
for (const [key, item] of Object.entries(itemsAssets)) {
  const imageUri = Image.resolveAssetSource(item.img).uri;

  parsedBase64Images[key] = await FileSystem.readAsStringAsync(imageUri, {
    encoding: FileSystem.EncodingType.Base64,
  });
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.