Reputation: 139
I pulled down the repo for our mobile app, added our custom PNG image files into the assets folder, updated the paths in app.json for "icon" and "splash". I expected this to display custom app icon and splash screen images. However, when I run our npm run android
script, which builds and runs the app by running expo run:android
, the default Expo icon is still displayed for the app icon and app splash page.
"icon": "./src/assets/images/icon.png",
"splash": {
"image": "./src/assets/images/splash.png"
}
}
I even confirmed the image's location using the command ls ./src/assets/images/icon.png
.
Ensured the images are in PNG format.
Cleared caches using expo start --clear
, deleted node_modules
, and executed fresh dependency installations.
Reset the data on the Android Virtual Device (AVD).
Created a test app using npx create-expo-app
. This app successfully displayed the custom splash image (but not the icon image, since it was running in Expo Go) when I ran npm run android
.
I realized that the test app's script was running expo start --android
while the main app's script was running expo run:android
. I modified this to match the test app's script and saw the same behavior as with the test app. However, I need it to run and work with expo run: android
.
I tried to run the app on a physical device but ran into problems when when trying to scan the QR code.
I don't have a ton of mobile dev experience and am pretty stuck at this point. If you have any ideas or have run into this before, I'd really appreciate some help. Thanks!
Upvotes: 8
Views: 8611
Reputation: 20229
If your problem is the Expo Go app is showing the wrong splash image (showing icon.png), that's a known limitation of Expo Go.
You can check the note there in the official doc, and try the alternatives they mention (use "preview build" or "production build")
https://docs.expo.dev/develop/user-interface/splash-screen-and-app-icon/
Upvotes: 1
Reputation: 24962
We have to decode their docs as always ðŸ˜
expo-splash-screen
but it's incomplete and will not work if you update the image, so you will need to clean it up and start from ground up.app.json
.npx expo install expo-splash-screen
. It may or may not be installed by default, lol, so install just to be sure! I actually think they started shipping it installed by default since the task is labeled outdated, so this maybe is not needed 🤷app.json
but using the plugin's config.npx expo prebuild --clean
, then npx expo run:ios --configuration Release --device
Upvotes: 1
Reputation: 139
I fixed it by running npx expo prebuild --clean
and then npx expo prebuild
Upvotes: 1