【问题标题】:blank splash screen on android with phonegap build带有phonegap构建的android上的空白闪屏
【发布时间】:2014-01-17 11:04:56
【问题描述】:

我使用 phonegap 构建和 phonegap 3,我无法让我的启动画面在 android 设备上工作(没有在 ios 上测试)。没有错误,也没有启动画面......在apk中我看到了我的启动图像,就像phonegap build在应用启动时忽略它们。

这里是我的 config.xml 文件:

<?xml version="1.0" encoding="UTF-8" ?>
    <widget xmlns   = "http://www.w3.org/ns/widgets"
        xmlns:gap   = "http://phonegap.com/ns/1.0"
        id          = "com.phonegap.example"
        versionCode = "10" 
        version     = "1.0.0" >

    <preference name="phonegap-version" value="3.0.0" />
    <preference name="orientation" value="portrait" />
    <!-- versionCode is optional and Android only -->

    <!-- Core plugins -->
    <gap:plugin name="org.apache.cordova.splashscreen" />
    <gap:plugin name="org.apache.cordova.media" version="0.2.3" />

    <name>ALLO</name>

    <description>
        Application mobile 
    </description>

    <author href="https://www.mywebsite.fr" email="support@mywebsite.fr">
        Henri Labarre 
    </author>

    <gap:platform name="ios" />
    <gap:platform name="android" />

    <!-- icon -->    
    <icon src="res/icons/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
    <icon src="res/icons/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
    <icon src="res/icons/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
    <icon src="res/icons/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />
    <icon src="res/icons/ios/icon.png" gap:platform="ios" width="57" height="57" />
    <icon src="res/icons/ios/icon-72.png" gap:platform="ios" width="72" height="72" />
    <icon src="res/icons/ios/icon_at_2x.png" gap:platform="ios" width="114" height="114" />
    <!-- retina iPad support: PhoneGap 2.5.0+ only -->
    <icon src="res/icons/ios/icon-72_at_2x.png" gap:platform="ios" width="144" height="144" />    

    <!-- splash screen -->
    <gap:splash src="res/screen/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
    <gap:splash src="res/screen/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
    <gap:splash src="res/screen/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
    <gap:splash src="res/screen/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />


    <access origin="http://mywebsite.fr" subdomains="true" />    

</widget>

谢谢

【问题讨论】:

    标签: cordova phonegap-build


    【解决方案1】:

    发现问题:调试模式无法启动闪屏。删除它时,它按预期工作。

    【讨论】:

    • 你是怎么去掉配置中的调试模式的?
    • 我知道你可以使用cordova build --release 构建一个版本,phonegap 命令应该类似。
    【解决方案2】:

    我在同一个问题上拉了我的头发。我的自定义闪屏就位,我的 config.xml 看起来完美无瑕。

    经过几个小时的调查和蛮力测试,我发现(至少在撰写本文时),我需要执行两个“秘诀”步骤才能让我的启动画面更新“采取” (尤其是如果我启用了水合作用 - 请参阅下面的特别说明)。我认为这是 Phonegap 构建工具中的一个错误或缺陷,希望有一天会得到解决:

    1. 在 Phonegap Build 网站上,单击页面顶部的“全部重建”按钮。 (请注意,我说的是“全部重建”,不是每个单独平台旁边的重建按钮 - 如果我分别为 android、ios 等单独进行单独重建,则不会应用更新)。

    2. 重新安装我的目标 android/ios 设备上的应用程序(我只是能够在现有版本上下载并重新安装它;我做了 不需要卸载现有的安装,至少在 android 上)。

    关于补水的特别说明(也就是猜测为什么会发生这种情况):我的印象是,正如宣传的那样,任何 www 文件或启动屏幕文件更新都会自动被补水应用程序拉下对我的真实代码文件(css、html、javascript)的任何更新。然而,我观察到的情况很有趣:启动屏幕更新没有立即下降(在 hydra 更新期间),但我的 www javascript、html、css 文件的任何更新都立即下降,即使没有进行全部重建。虽然这似乎令人惊讶,但为什么会这样的线索可能来自以下观察:当您单击全部重建时,ipa 和 apk 的重建需要相当长的时间才能完成,但是如果您单击每个平台旁边的重建,它花费的时间大大减少。这表明 Rebuild All 会强制系统重新构建整个应用程序(包括图标、闪屏、水合逻辑等),而进行一对一的平台重建会执行“LIGHT”重建(更新 html、js、等代码文件,而不是图标和闪屏等资源)。

    底线:尝试点击全部重建按钮并在设备上重新安装应用程序(不仅仅是进行水合更新)。

    【讨论】:

      【解决方案3】:

      将此添加到根目标或 www/config.xml 中的 config.xml

      <gap:splash src="splash.png" />
      
      <gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="res/screen/android/screen-ldpi-portrait.png" />
      <gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="res/screen/android/screen-mdpi-portrait.png" />
      <gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="res/screen/android/screen-hdpi-portrait.png" />
      <gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="res/screen/android/screen-xhdpi-portrait.png" />
      

      Phonegap 文档中提到过:-

      http://docs.build.phonegap.com/en_US/configuring_icons_and_splash.md.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-04-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多