manipulateAsync fails in a standalone app built with EAS

Hey everybody,

I’m running standalone app built with EAS on Android. After requesting permissions via MediaLibrary.requestPermissionsAsync() and picking an image, I’m trying to resize it using ImageManipulator with these params:

ImageManipulator.manipulateAsync(
  'file:///storage/emulated/0/Pictures/SomeApp/some_image.jpg',
  [{
    resize: {
      height: 1024,
    },
  }],
  { compress: 0.7 },
);

Which fails and throws an exception:

Encountered an exception while calling native method: Exception occurred while executing exported method manipulateAsync on module ExpoImageManipulator: Attempt to invoke interface method 'void org.unimodules.interfaces.imageloader.ImageLoader.loadImageForManipulationFromURL(java.lang.String, org.unimodules.interfaces.imageloader.ImageLoader$ResultListener)' on a null object reference

It looks like the native ImageLoader in ImageManipulatorModule is null.

I’m using monorepo with expo-yarn-workspaces.
I’ve got expo-image-manipulator and all unimodules-related packages (@unimodules/core, @unimodules/react-native-adapter, react-native-unimodules, unimodules-app-loader, unimodules-barcode-scanner-interface, unimodules-camera-interface, unimodules-constants-interface, unimodules-face-detector-interface, unimodules-file-system-interface, unimodules-font-interface, unimodules-image-loader-interface, unimodules-permissions-interface) symlinked in package.json and EAS build goes through without an issue.
The operation works fine when app’s running through Expo Go or when built with expo build.

I’ve come across a thread describing similar exception thrown from permissions module in a bare workflow project. But that one’s been fixed already.

So my question really is if this could be somehow related to build done with EAS or am I missing something on my part? Did you have any issues with ImageManipulator and EAS?

the list of modules you shared above does not seem to include expo-image-loader, which is the concrete implementation of the interface. it’s a dependency in react-native-unimodules. it seems like it’s missing from symlinks. next sdk we’ll release an update with a new version of the autolinking script to fix the symlinking requirement, but for now you may want to do something like this: [eas][ios]: TypeError: undefined is not an object (evaluating 'n.default.currency') · Issue #12867 · expo/expo · GitHub

1 Like

You’re right, I’ve missed expo-image-loader and few others while going through unimodules’ dependencies. Thanks a ton! I’m excited for the next SDK!

In case anyone stumbles across this post, this example repo by @bycedric has been invaluable while migrating my project’s monorepo to EAS.

2 Likes

I’m glad you find it useful! If there is anything you encountered and is not listed in that repo, lmk. We can add it for the next person :slight_smile:

1 Like