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

Android应用启动前出现黑屏问题求助

Hey there, I totally get how frustrating that persistent gray/black launch screen can be—especially after hours of digging through docs and Stack Overflow hits that don't pan out. Let's break down what might be going wrong with your PGB CLI-6.5.0 setup and fix that launch screen issue.

1. Double-Check the gap:config-file Syntax & Placement

You mentioned trying the gap:config-file variant, but let's make sure it's properly nested and targets the right manifest node. Your current config uses a regular <config-file> entry—swap that out for the PGB-specific version, and adjust the parent path to target the existing application node directly (this avoids merge conflicts):

<platform name="android">
    <!-- Replace your existing config-file entry with this -->
    <gap:config-file platform="android" parent="/manifest/application" mode="merge">
        <application android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    </gap:config-file>
    <!-- Rest of your Android config remains here -->
</platform>

2. Use a Custom Transparent Theme (Instead of System Default)

System themes can sometimes clash with Cordova's splashscreen plugin. Let's create a custom transparent theme tailored to your app:

  1. Create the path res/android/values/styles.xml in your project (if it doesn't exist) with this content:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="CustomTransparentTheme" parent="@android:style/Theme.DeviceDefault.NoActionBar">
            <item name="android:windowBackground">@android:color/transparent</item>
            <item name="android:windowIsTranslucent">true</item>
            <item name="android:windowNoTitle">true</item>
        </style>
    </resources>
    
  2. Update your gap:config-file entry to reference this custom theme:
    <gap:config-file platform="android" parent="/manifest/application" mode="merge">
        <application android:theme="@style/CustomTransparentTheme" />
    </gap:config-file>
    

3. Tweak Your SplashScreen Plugin Configuration

Your current SplashScreenDelay is set to 10 seconds—this long delay might let the gray system screen show through before your splashscreen loads. Adjust these preferences to ensure the splashscreen takes over immediately:

<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="3000" /> <!-- Shorten to 3 seconds -->
<preference name="SplashShowOnlyFirstTime" value="true" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="FadeSplashScreen" value="false" /> <!-- Optional: Remove flicker from fade -->

4. Update Your Android Target SDK Version

Your android-targetSdkVersion is set to 12 (Android 3.1)—this is extremely outdated. Newer Android versions handle launch themes more reliably, and PGB's CLI-6.5.0 will work better with a more recent target. Try updating it to at least 23 (Android 6.0):

<preference name="android-targetSdkVersion" value="23" />

Final Step

After making these changes, do a full rebuild in PGB—avoid incremental builds, as old cached resources can prevent fixes from taking effect. If the issue persists, temporarily remove the splashscreen plugin to check if it's conflicting with your theme settings.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 06:17:40