当前位置: 首页 > 知识库问答 >
问题:

科尔多瓦Android白色闪屏

叶卓君
2023-03-14

前段时间我问(并解决了)我的应用程序的iOS版本的相同问题(Cordova iOS 6.1.1白色闪屏),现在我对Android有同样的问题。

我正在使用cordoa-cli-10.0.0使用在线工具构建apk

应用程序运行,但我只看到一个白屏,而不是我的闪屏文件。

在我的配置.xml文件中,我有以下初始屏幕设置(我在这里跳过了其他设置,如果需要,我可以发布它们):

  <preference name="SplashScreenDelay" value="3000" />
  <platform name="android">
      <splash src="res/screen/android/PackageIcons.Android.splash_480_800.png" density="hdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_200_320.png" density="ldpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_320_480.png" density="mdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_720_1280.png" density="xhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_960_1600.png" density="xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_1280_1920.png" density="xxxhdpi"/>

      <splash src="res/screen/android/PackageIcons.Android.splash_800_480.png"  density="land-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_320_200.png"  density="land-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_480_320.png"  density="land-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_1280_720.png"  density="land-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_1600_960.png" density="land-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_1920_1280.png" density="land-xxxhdpi"/>
      
      <splash src="res/screen/android/PackageIcons.Android.splash_480_800.png"  density="port-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_200_320.png"  density="port-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_320_480.png"  density="port-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_720_1280.png"  density="port-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_960_1600.png" density="port-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_1280_1920.png" density="port-xxxhdpi"/>
      
      <splash src="res/screen/android/PackageIcons.Android.splash_800_480.png"  density="land-night-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_320_200.png"  density="land-night-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_480_320.png"  density="land-night-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_1280_720.png"  density="land-night-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_1600_960.png" density="land-night-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_1920_1280.png" density="land-night-xxxhdpi"/>
      
      <splash src="res/screen/android/PackageIcons.Android.splash_480_800.png"  density="port-night-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_200_320.png"  density="port-night-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_320_480.png"  density="port-night-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_720_1280.png"  density="port-night-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android.splash_960_1600.png" density="port-night-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android.splash_1280_1920.png" density="port-night-xxxhdpi"/>
      
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_36_36.png" density="ldpi" />
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_48_48.png" density="mdpi" />
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_72_72.png"  density="hdpi" />
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_96_96.png"  density="xhdpi" />
  </platform>

我添加了xxhdpi和xxxhdpi文件以及暗模式设置,但它仍然是一个白色启动屏幕。你能帮我吗?

更新

这是我的整个配置文件.xml

<widget id="com.xxx.xxx" version="1.1.22" versionCode="22" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <name>xxx</name>
  <description>Template</description>
  <author email="info@xxx.com" href="xxx">xxx</author>
  <preference name="permissions" value="none" />
  <preference name="prerendered-icon" value="true" />
  <preference name="phonegap-version" value="cli-10.0.0" />
  <preference name="android-windowSoftInputMode" value="adjustPan" />
  <preference name="AutoHideSplashScreen" value="true" />
  <preference name="SplashScreenDelay" value="3000" />
  <!--<preference name = "SplashScreen" value = "screen" />-->
  <feature name="LaunchScreen">
     <param name="ios-package" value="LaunchScreenStoryboard" onload="true" />
     <preference name="StoryboardName" value="LaunchScreen" />
     <preference name="FadeOut" value="true" />
     <preference name="FadeOutDuration" value="1" />
   </feature>
  <preference name="DisallowOverscroll" value="true" />
  <preference name="StatusBarOverlaysWebView" value="false" />
  <preference name="StatusBarStyle" value="default" />
  <feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" onload="true" />
  </feature>
  <preference name="StatusBarBackgroundColor" value="#000000" />
  <preference name="android-minSdkVersion" value="22" />
  <preference name="android-targetSdkVersion" value="28" />
  <plugin name="cordova-plugin-geolocation" source="npm">
    <param name="GEOLOCATION_USAGE_DESCRIPTION" value="xxx." />
  </plugin>
  <plugin name="cordova-plugin-inappbrowser" />
  <plugin name="cordova-plugin-whitelist" />
  <access origin="*" />
  <allow-intent href="*" />
  <plugin name="cordova-plugin-ios-longpress-fix" />
  <plugin name="cordova-android-support-gradle-release">
    <variable name="ANDROID_SUPPORT_VERSION" value="28.0.0"/>
  </plugin>
  <preference name="scheme" value="app" />
  <preference name="hostname" value="localhost"  /> 
  <plugin name="cordova-custom-config" version="*" />
  <plugin name="cordova-plugin-file" />
  <plugin name="cordova-plugin-file-opener2"/><!-- source="git" spec="https://github.com/neptsoft/cordova-plugin-file-opener2" />-->
  <plugin name="cordova-plugin-app-version" />
  <plugin name="cordova-plugin-exit" />
  <platform name="ios">
    <preference name="WKWebViewOnly" value="true" />
    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
  </platform>
  <edit-config target="NSLocationAlwaysUsageDescription" file="*-Info.plist" mode="merge">
    <string>xxx</string>
  </edit-config>
  <edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>xxx</string>
  </edit-config>
  <edit-config target="NSLocationAlwaysAndWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>xxx</string>
  </edit-config>
  <edit-config target="CFBundleShortVersionString" file="*-Info.plist" mode="merge">
    <string>1.1.22</string>
  </edit-config>
  <platform name="android">
      <splash src="res/screen/android/PackageIcons.Android_splash_480_800.png" density="hdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_200_320.png" density="ldpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_320_480.png" density="mdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_720_1280.png" density="xhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_960_1600.png" density="xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_1280_1920.png" density="xxxhdpi"/>

      <splash src="res/screen/android/PackageIcons.Android_splash_800_480.png"  density="land-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_320_200.png"  density="land-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_480_320.png"  density="land-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_1280_720.png"  density="land-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_1600_960.png" density="land-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_1920_1280.png" density="land-xxxhdpi"/>
      
      <splash src="res/screen/android/PackageIcons.Android_splash_480_800.png"  density="port-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_200_320.png"  density="port-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_320_480.png"  density="port-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_720_1280.png"  density="port-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_960_1600.png" density="port-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_1280_1920.png" density="port-xxxhdpi"/>
      
      <splash src="res/screen/android/PackageIcons.Android_splash_800_480.png"  density="land-night-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_320_200.png"  density="land-night-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_480_320.png"  density="land-night-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_1280_720.png"  density="land-night-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_1600_960.png" density="land-night-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_1920_1280.png" density="land-night-xxxhdpi"/>
      
      <splash src="res/screen/android/PackageIcons.Android_splash_480_800.png"  density="port-night-hdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_200_320.png"  density="port-night-ldpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_320_480.png"  density="port-night-mdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_720_1280.png"  density="port-night-xhdpi" />
      <splash src="res/screen/android/PackageIcons.Android_splash_960_1600.png" density="port-night-xxhdpi"/>
      <splash src="res/screen/android/PackageIcons.Android_splash_1280_1920.png" density="port-night-xxxhdpi"/>
      
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_36_36.png" density="ldpi" />
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_48_48.png" density="mdpi" />
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_72_72.png"  density="hdpi" />
      <icon src="res/screen/android/PackageIcons.Android.ic_launcher_96_96.png"  density="xhdpi" />
  </platform>
  <platform name="ios">
      <icon src="res/screen/ios/PackageIcons.iOS.iTunesArtwork.png"/>
      <splash src="res/screen/ios/Default@2x~universal~anyany.png" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon.png" width="57" height="57" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-60.png" width="60" height="60" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-72.png" width="72" height="72" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-76.png" width="76" height="76" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon@2x.png" width="114" height="114" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-60@2x.png" width="120" height="120" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-88@2x.png" width="167" height="167" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-72@2x.png" width="144" height="144" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-76@2x.png" width="152" height="152" />
      <icon src="res/screen/ios/PackageIcons.iOS.icon-60@3x.png" width="180" height="180" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon40x40~ipad.png" width="40" height="40" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon40x40@2x.png" width="80" height="80" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon40x40@3x.png" width="120" height="120" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon50x50~ipad.png" width="50" height="50" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon50x50@2x~ipad.png" width="100" height="100" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon29x29.png" width="29" height="29" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon29x29@2x.png" width="58" height="58" />
      <icon src="res/screen/ios/PackageIcons.iOS.AppIcon29x29@3x.png" width="87" height="78" />
      <icon src="res/screen/ios/PackageIcons.iOS.iTunesArtwork.png" width="1024" height="1024" />
  </platform>
  
</widget>

共有2个答案

海雪松
2023-03-14

好吧,线索找到了。

我删除了对插件cordova插件splashscreen的引用,因为在cordova iOS 6.1.1中已经包含。但是,这在iOS中工作,您必须保持以下行才能在Android中工作:

<plugin name="cordova-plugin-splashscreen" />

我添加后,闪屏显示。

柏明亮
2023-03-14

也许使用适当的文件命名,重命名您的

PackageIcons.Android.splash_1280_1920.png

PackageIcons_Android_splash_1280_1920.png

我也没看到

 类似资料:
  • 嗨,我运行ionic命令时出现以下错误()。任何线索都将不胜感激。我的Java是9.0.1,错误消息对我来说没有意义。请提出你的想法。 ANDROID_HOME=C:\程序文件(x86)\Android\android-sdkJAVA_HOME=C:\程序文件\Java\jdk-9.0.1错误:JDK 1.8或更高版本的需求检查失败 [错误]运行科尔多瓦运行Android时出错(退出代码 1)。

  • 更新1: 这就是我最后所做的一切: 这些都不是必须的吗? 原始问题: 在我的Ubuntu 12.04电脑上,我刚刚安装了npm和cordovanode.js: 当我尝试添加Android: 我得到以下输出: 有人知道为什么会发生这种情况以及如何解决吗? 我对PhoneGap也有同样的问题。

  • 我知道有很多这样的线程,但没有一个有帮助。 我使用的是Windows 10,Cordova 7.1.0(最新版本),我已经安装了带有SDK平台7.1.1-API级别25的Android Studio(也尝试降级到7.0-API级别24)。此外,我使用Android Studio SDK管理器安装了SDK构建工具。 正在运行: 我收到以下消息: Android SDK设置不正确。确保Android

  • 我试图在我的Android手机上运行我的科尔多瓦应用程序。我得到以下错误在构建:输入图像描述在这里 在此处输入图像描述 在我的环境变量中,路径设置为SDK、工具和平台工具。ANDROID_主页到SDK,JAVA_主页到JDK文件夹。

  • 我正在建立第一个科尔多瓦项目。 在全球安装Cordova并创建第一个应用程序存储库后,我试图在此命令中设置android平台: 科尔多瓦平台添加Android--保存 但此操作最终会生成此错误消息: 构建失败 总时间: 0.989 秒 无法安装“科尔多瓦插件白名单”:错误: /家/费拉斯/局/科尔多瓦/你好世界/你好世界/平台/机器人/gradlew: 命令失败,退出代码为 1 在儿童进程.当当到

  • 在使用Cordova编译android命令为Cordov-android生成应用程序时,我收到以下错误并且无法继续。 哪里出错了:任务执行失败。 .xml 执行时出现故障 我尝试了堆栈流中收到的几个选项,但无法解决它。