Search code examples
react-nativeexpoandroid-imageexpo-build

Remote images not loading in production generated with Expo for Android


I'm developing an application with Expo for Android, using various APIs, including Google Books to retrieve book images from its database. Everything works correctly in the development environment; all images load properly. However, when I generate the .aab file for publication, the remote images fail to load. All other content, such as book titles, IDs, etc., displays correctly, indicating that the API is functioning properly, but remote images do not work.

Strangely, local images load without any issues. This issue has persisted since the beginning of the application's development, and I've tried various solutions such as using Expo-Images, but to no avail. I also tryed to load images on cahce link this:

async function cacheImages(images) {
  const imageAssets = images.map(image => {
    if (typeof image === 'string') {
      return Image.prefetch(image);
    } else {
      return Asset.fromModule(image).downloadAsync();
    }
  });

  await Promise.all(imageAssets);
}

The image loading code is simple, and I've verified it several times against the Expo documentation for potential errors:

<Image source={{ uri: bookImage }} style={styles.image} />

I've tried troubleshooting this issue extensively but haven't found a solution. Any insights or suggestions on how to resolve this problem would be greatly appreciated.

CLI version: >= 7.5.0 Expo version: ~50.0.15


Solution

  • Can you check the SSL or the link of the images? Usually apps(android and IOS) both does not entertain the insecure links such as http:// . Make sure that the remote links which you provide are of https://