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

Next/Capacitor应用实现SplashScreen启动页 安卓端不显示如何解决?

Capacitor SplashScreen启动页不显示排查步骤
  • 确认安装了独立的SplashScreen插件:Capacitor v3及以上版本SplashScreen已从@capacitor/core中拆分,需要单独安装并同步配置:
npm install @capacitor/splash-screen
npx cap sync
  • 检查Android项目资源是否匹配配置:你在capacitor.config.json中指定了androidSplashResourceName为splash,需要确保android/app/src/main/res目录下各对应分辨率的drawable文件夹中,存在名为splash的启动页资源(png格式图片或者xml格式的层叠资源)。
  • 检查Android主题配置是否正确:打开android/app/src/main/res/values/styles.xml,确认已配置正确的启动页主题,示例如下:
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
    <item name="windowSplashScreenBackground">@color/你的启动页背景色</item>
    <item name="windowSplashScreenAnimatedIcon">@drawable/splash</item>
    <item name="postSplashScreenTheme">@style/AppTheme.NoActionBar</item>
</style>
  • 检查AndroidManifest配置:打开android/app/src/main/AndroidManifest.xml,确认主启动Activity的android:theme属性设置为上面配置的启动页主题:
<activity
    android:name=".MainActivity"
    android:theme="@style/AppTheme.NoActionBarLaunch"
    ...>
</activity>
  • 排除代码提前隐藏启动页的问题:检查应用入口逻辑(比如Next.js的_app.tsx、首页组件初始化逻辑),是否存在启动时立即调用SplashScreen.hide()的代码,该操作会导致启动页刚渲染就被关闭。
  • 确认配置已同步到原生项目:每次修改capacitor.config.json或依赖后,都需要执行npx cap sync android同步配置,修改原生项目资源/配置后,需要在Android Studio中执行Clean Project再重新构建运行,避免缓存导致配置不生效。
  • Android 12+适配问题:如果运行的模拟器是Android 12及以上系统,需要适配官方新启动页规范,不能沿用旧版全屏启动页配置,否则会出现启动页不显示的问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.25 13:15:04