Relative Content

Tag Archive for androidreact-nativeexpo

How to base64 encode a png asset in expo 50 android production app

I have been trying to get this to work for ages and have tried many different ways to get this to work. I am trying to get a bundled asset in an android app, created with expo 50, base64 encode it so I can use it to create a PDF. It works fine in development but after building the APK it doesn’t load. I am not able to use Asset from expo assets as that is for sdk 51 I believe. I have found threads elsewhere that say to prepend file:/// or file:///android_asset or file:///android_res to the resource identifier that is available from assets[0].localUri but none of these variations work, the issue is not that assets[0].localUri is undefined, it is that I don’t know how to use this resource identifier to access the resource with FileSystem. I have tried unzipping an APK to look at the file structure but it is not like a normal android app, I can’t see any mention of any of the image i am trying to use, however there are other images the app uses, for splash screen etc. and i cant find those either even though they do work. Here is a minimal version of the screen that I am trying to get working. I am greatful for any help.

ERROR TypeError: Cannot read property ‘__expo_module_name__’ of undefined, js engine: hermes

{ … “scripts”: { “off”: “expo start –offline”, “start”: “expo start”, “android”: “expo start –android”, “ios”: “expo start –ios”, “web”: “expo start –web” }, “dependencies”: { “@react-native-async-storage/async-storage”: “^1.23.1”, “@react-native-community/art”: “^1.2.0”, “@react-native-community/netinfo”: “9.3.10”, “@react-native-picker/picker”: “2.4.10”, “@react-navigation/material-bottom-tabs”: “^6.2.4”, “@react-navigation/material-top-tabs”: “^6.5.3”, “@react-navigation/native”: “^6.0.13”, “@react-navigation/native-stack”: “^6.9.0”, “@react-navigation/stack”: “^6.3.1”, “@svanboxel/visibility-sensor-react-native”: “^1.0.2”, “axios”: “^1.1.3”, “country-data”: “^0.0.31”, “expo”: “^51.0.18”, “expo-av”: “~13.4.1”, “expo-blur”: […]