expo build:android produces APK with missing image assets

Forgive me if this is a naive question but I cannot for the life of me figure out why my APKs built with the expo build:android command are missing some art assets. They’re all used in the JSX in a manner similar to this:

source={require(“images/imageName.png”)}

The path is correct and they all show up when debugging with expo start.

I have noticed the following messages when running expo build:android:

“Uploading assets
No assets to upload, skipped.”

Could it be that Expo is not detecting the images? If so, can I force a refresh somehow?

Thanks in advance.

Hey @evaunit02,

Are you pre-fetching the assets with AppLoading at all? Also, you may want to explore bundling your assets to increase start-up time performance.

Cheers,
Adam

Thanks so much for your reply. I genuinely appreciate the help.

I wasn’t prefetching the assets with AppLoading, no. However, I just tried it and it didn’t work for me. Granted, I didn’t prefetch in the App object itself. I prefetched them in my first Screen object instead but I followed the example you linked to.

I also tried bundling the assets as described by your second link. However, when I do that, uploading the APK generated by “expo build:android” to Google Play fails with an undescribed error.

However, I couldn’t bundle using an asterisk as in the documentation example, “assets/images/*” The app would fail to load in that case when I launched it with “expo start”. When I removed the asterisk (“assets/images/”) the app would load without error. I’m not really sure what was going on there.

For anyone else who comes across this problem, I finally discovered the solution: Expo can’t properly run on React Native itself. It runs on a custom fork of React Native which can be found here:

For Expo 32.0.0, your npm dependency in package.json should read:

"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz"

Perhaps Expo should look for an identifier for their fork of RN when “expo start” is run. Otherwise, Expo seems to run just fine until wonky things happen.

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