You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo应用启动页显示应用图标而非指定启动图问题求助

问题描述

我的app.json配置如下:

{
  "expo": {
    "name": "SignLingo",
    "slug": "SignLingo",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/images/icon.png",
    "scheme": "myapp",
    "userInterfaceStyle": "automatic",
    "newArchEnabled": true,
    "splash": {
      "image": "./assets/images/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#fefaf4"
    },
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.anonymous.SignLingo"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      },
      "package": "com.anonymous.SignLingo"
    },
    "web": {
      "bundler": "metro",
      "output": "static",
      "favicon": "./assets/images/favicon.png"
    },
    "plugins": [
      "expo-router",
      [
        "expo-splash-screen",
        {
          "image": "./assets/images/splash-icon.png",
          "imageWidth": 200,
          "resizeMode": "contain",
          "backgroundColor": "#ffffff"
        }
      ]
    ],
    "experiments": {
      "typedRoutes": true
    }
  }
}
  • 应用图标(./assets/images/icon.png):应用图标
  • 指定的启动图(./assets/images/splash.png):启动图
  • 实际启动页效果:实际启动页效果

两个文件均存在,应用图标显示正常,但启动页只显示应用图标而非指定的splash.png,仅背景色#fefaf4显示正确。已执行npx expo prebuild --clean和npx expo prebuild命令,问题未解决。

问题原因

核心原因是**expo-splash-screen插件的配置覆盖了根节点splash的设置**:

  1. 插件配置中指定了image: "./assets/images/splash-icon.png",该配置优先级高于根节点的splash.image;
  2. 由于splash-icon.png不存在或路径错误,Expo自动 fallback 使用应用图标作为启动图内容;
  3. 插件配置的backgroundColor: "#ffffff"未生效,是因为根节点splash.backgroundColor的优先级更高,因此显示#fefaf4。
解决方法

方案1:统一使用根节点的splash配置(推荐)

删除plugins中的expo-splash-screen自定义配置,让根节点的splash设置完全生效:

"plugins": [
  "expo-router"
  // 移除原有的expo-splash-screen配置块
]

方案2:在插件配置中指定正确的启动图

如果需要保留expo-splash-screen插件的自定义配置,将插件内的image路径改为正确的splash.png,并统一背景色:

"plugins": [
  "expo-router",
  [
    "expo-splash-screen",
    {
      "image": "./assets/images/splash.png",
      "imageWidth": 200,
      "resizeMode": "contain",
      "backgroundColor": "#fefaf4" // 和根节点背景色保持一致
    }
  ]
]

最终生效步骤

修改配置后,执行以下命令确保配置同步:

  1. 清理旧预构建文件:npx expo prebuild --clean
  2. 重新预构建:npx expo prebuild
  3. 重新运行项目:npx expo run:android 或 npx expo run:ios

注意:若使用Expo Go预览,需重新生成开发客户端(执行npx expo run:android/npx expo run:ios),因为Expo Go不会读取本地预构建配置。

内容的提问来源于stack exchange,提问作者etayluz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 02:13:25