So I had an existing project that I was maintaining for a client. We had to add a new native package and in order to publish to the play store, I needed to upgrade the SDK from 33 to 34. So once I went through all the steps to upgrade and tried to run the app in production mode I received the following error and none of my images were loading.
[Error: File 'file:///var/containers/Bundle/Application/E4ECB958-7A51-4AC2-8EA3-941159139966/golf-association-of-philadelphia.app/asset_2927cd6a27e029ef8c02cb8b609db978.otf' for font 'D733CF6F-E252-4E51-B683-A5B227677751-gothamBlack' doesn't exist]
I did install expo-asset and expo-font as instructed and left all my existing code the same to cache and load fonts but I am stumped on this one. Just for reference this is the code I am using to cache assets.
const cacheImages = images => {
return images.map(image => {
if (typeof image === "string") {
return Image.prefetch(image);
} else {
return Asset.fromModule(image).downloadAsync();
}
});
};
async _loadAssetsAsync() {
const imageAssets = cacheImages([
require("./assets/ghinlogo.png"),
require("./assets/favorite-outline.png"),
require("./assets/favorite-filled.png"),
require("./assets/favorite-white-outline.png"),
require("./assets/favorite-white-filled.png"),
require("./assets/profile.png"),
require("./assets/badge_updated.png")
]);
const fonts = Font.loadAsync({
gothamBlack: require("./assets/fonts/Gotham-Black.otf"),
gothamBlackItalic: require("./assets/fonts/Gotham-BlackItalic.otf"),
gothamBold: require("./assets/fonts/Gotham-Bold.otf"),
gothamBoldCondensed: require("./assets/fonts/Gotham-BoldCondensed.otf"),
gothamBlackItalic: require("./assets/fonts/Gotham-BoldItalic.otf"),
gothamBook: require("./assets/fonts/Gotham-Book.otf"),
gothamLightCondensed: require("./assets/fonts/Gotham-LightCondensed.otf"),
gothamMedium: require("./assets/fonts/Gotham-Medium.otf"),
nothingYouCouldDo: require("./assets/fonts/NothingYouCouldDo.ttf")
});
return await Promise.all([...imageAssets, fonts]);
}