Third-party module undefined in Android prodRelease build variant

#1

I’m trying to implement the react-native-fs module in my detached Expo application. The module loads and works when compiling development build variants and running with Expo XDE, but comes up as undefined in the prodRelease variant. Here is the error:

undefined is not an object (evaluating t.RNFSFileTypeRegular)

I’ve tried disabling minification to see if that helps but can’t get past the dex capacity reached issue.

I’m running Expo SDK v24 and Android Studio 3.0.1.

I should mention this works perfectly with iOS in both production and development builds.

2 Likes
#2

I’ve also had trouble getting react-native-fs to play well with android…

#3

why would you use this? expo has a FileSystem API: https://docs.expo.io/versions/v27.0.0/sdk/filesystem

#4

Unfortunately expo filesystem api didn’t have what I needed. However, I was able to get this to work by disabling proguard (minifyEnabled false) in my release build config, if that helps anyone.

#5

out of curiosity, what did you need from the filesystem api?

#6

I needed to use the writeFile method to write base64 data to save a jpeg to the app document directory, something like so: RNFS.writeFile(destinationPath, imageData, 'base64')

Based on what I read here in the expo forums I figured using RNFS module was the only way.

closed #7

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