Splash screen is not display after build on phonegap version cli 5.2.0

不问归期 提交于 2019-12-23 01:52:55

问题


I have made splash screen for phonegap application but after upgrade my splash screen is not display i have written code in cofig file is as below and also i have added screen as per phonegap splash screen documentation. and also i have added default screen image in project.

  <widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.abc.mobileapp" version="1.0.0" versionCode = "10">
  <name>abc</name>
  <description></description>
  <author email="admin@abc.com">abc</author>
  <content src="abc.html"/>
  <preference name='phonegap-version'/>
  <preference name="permissions" value="none"/>
  <preference name="orientation" value="default"/>
  <preference name="target-device" value="universal"/>
  <preference name="fullscreen" value="false"/>
  <preference name="webviewbounce" value="true"/>
  <preference name="prerendered-icon" value="true"/>
  <preference name="stay-in-webview" value="false"/>
  <preference name="ios-statusbarstyle" value="black-opaque"/>
  <preference name="detect-data-types" value="true"/>
  <preference name="exit-on-suspend" value="false"/>
  <preference name="show-splash-screen-spinner" value="true"/>
  <preference name="auto-hide-splash-screen" value="true"/>
  <preference name="disable-cursor" value="false"/>
  <preference name="android-minSdkVersion" value="14"/>
  <preference name="android-installLocation" value="auto"/>
  <!--<preference name="SplashScreen" value="screen" />-->
  <preference name="SplashScreenDelay" value="5000" />
  <!--<preference name="splash-screen-duration" value="6000" />-->

  <!--<gap:plugin name="org.apache.cordova.battery-status"/>
  <gap:plugin name="org.apache.cordova.camera"/>
  <gap:plugin name="org.apache.cordova.media-capture"/>
  <gap:plugin name="org.apache.cordova.console"/>
  <gap:plugin name="org.apache.cordova.contacts"/>
  <gap:plugin name="org.apache.cordova.device"/>
  <gap:plugin name="org.apache.cordova.device-motion"/>
  <gap:plugin name="org.apache.cordova.device-orientation"/>
  <gap:plugin name="org.apache.cordova.dialogs"/>
  <gap:plugin name="org.apache.cordova.file"/>
  <gap:plugin name="org.apache.cordova.file-transfer"/>
  <gap:plugin name="org.apache.cordova.geolocation"/>
  <gap:plugin name="org.apache.cordova.globalization"/>-->
  <gap:plugin name="org.apache.cordova.device" source="npm"/>
  <gap:plugin name="cordova-plugin-inappbrowser" source="npm" />
  <gap:plugin name="nl.x-services.plugins.socialsharing" source="plugins.cordova.io" />

  <gap:plugin name="org.apache.cordova.network-information"  version="0.2.12" source="npm"/>
  <gap:plugin name="org.apache.cordova.splashscreen" version="0.3.4" source="npm" />
  <gap:plugin name="org.apache.cordova.vibration" version="0.3.11" source="npm"/>
  <gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.9.0">
    <param name="APP_ID" value="0000000000000000" />
    <param name="APP_NAME" value="abc" />
  </gap:plugin>

  <!-- Third party plugins -->
  <!-- A list of available plugins are available at https://build.phonegap.com/plugins -->
  <!--<gap:plugin name="com.phonegap.plugins.barcodescanner" />-->

  <!--https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/blob/2fdfde7/README.md
  <gap:plugin name="nl.x-services.plugins.toast" version="2.0.2" />-->

  <icon src="icon.png"/>
  <icon src="res/icon/android/icon-36-ldpi.png" gap:platform="android" gap:qualifier="ldpi"/>
  <icon src="res/icon/android/icon-48-mdpi.png" gap:platform="android" gap:qualifier="mdpi"/>
  <icon src="res/icon/android/icon-72-hdpi.png" gap:platform="android" gap:qualifier="hdpi"/>
  <icon src="res/icon/android/icon-96-xhdpi.png" gap:platform="android" gap:qualifier="xhdpi"/>
  <icon src="res/icon/blackberry/icon-80.png" gap:platform="blackberry"/>
  <icon src="res/icon/blackberry/icon-80.png" gap:platform="blackberry" gap:state="hover"/>
  <icon src="res/icon/ios/icon-57.png" gap:platform="ios" width="57" height="57"/>
  <icon src="res/icon/ios/icon-72.png" gap:platform="ios" width="72" height="72"/>
  <icon src="res/icon/ios/icon-57-2x.png" gap:platform="ios" width="114" height="114"/>
  <icon src="res/icon/ios/icon-72-2x.png" gap:platform="ios" width="144" height="144"/>
  <icon src="res/icon/webos/icon-64.png" gap:platform="webos"/>
  <icon src="res/icon/windows-phone/icon-48.png" gap:platform="winphone"/>
  <icon src="res/icon/windows-phone/icon-173-tile.png" gap:platform="winphone" gap:role="background"/>

  <gap:splash src="res/screen/default.png" />
  <gap:splash src="res/screen/android/screen-ldpi-portrait.png" gap:platform="android" gap:qualifier="port-ldpi"/>
  <gap:splash src="res/screen/android/screen-mdpi-portrait.png" gap:platform="android" gap:qualifier="port-mdpi"/>
  <gap:splash src="res/screen/android/screen-hdpi-portrait.png" gap:platform="android" gap:qualifier="port-hdpi"/>
  <gap:splash src="res/screen/android/screen-xhdpi-portrait.png" gap:platform="android" gap:qualifier="port-xhdpi"/>
  <gap:splash src="res/screen/blackberry/screen-225.png" gap:platform="blackberry"/>
  <gap:splash src="res/screen/ios/screen-iphone-portrait.png" gap:platform="ios" width="320" height="480"/>
  <gap:splash src="res/screen/ios/screen-iphone-portrait-2x.png" gap:platform="ios" width="640" height="960"/>
  <gap:splash src="res/screen/ios/screen-iphone-portrait-568h-2x.png" gap:platform="ios" width="640" height="1136"/>
  <gap:splash src="res/screen/ios/screen-ipad-portrait.png" gap:platform="ios" width="768" height="1024"/>
  <gap:splash src="res/screen/ios/screen-ipad-landscape.png" gap:platform="ios" width="1024" height="768"/>
  <gap:splash src="res/screen/windows-phone/screen-portrait.jpg" gap:platform="winphone"/>
  <access origin="*"/>
  <!--<access origin="*xitstage-001-site3.mysitepanel.net"/>-->
  <gap:plugin name="cordova-plugin-whitelist" version="1" source="npm"/>
  <allow-intent href="http://*/*"/>
  <allow-intent href="https://*/*"/>
  <allow-intent href="tel:*"/>
  <allow-intent href="sms:*"/>
  <allow-intent href="mailto:*"/>
  <allow-intent href="geo:*"/>
  <platform name="android">
    <allow-intent href="market:*"/>
  </platform>
  <platform name="ios">
    <allow-intent href="itms:*"/>
    <allow-intent href="itms-apps:*"/>
  </platform>
</widget>

What changeset i have to do with upgarde of phonegap application.


回答1:


@vatsal,
Okay, you have a quite a few mistakes that are common to developers new to Cordova/Phonegap.

First read, just the BOLD points in this document, because you will want to fix your stuff first, then get the finer details.

Top Mistakes by Developers new to Cordova/Phonegap

The FIRST THING you want to do is set a version for your compiler. For this read
6. Not setting the "phonegap version" for your compiler

I QUOTE

With the CLI version, if you do not assign a version for your platform (..)(and) If you are not lucky, you'll get a set of cascading error.

BTWS, you are not lucky. Doing this will NOT fix the mistakes, but it is important. You can read the entire document later for a better understanding.

NEXT THING you need to get ALL your core plugins from NPM from now on. And make sure to set the versions for this. For this read
11. You need to get your plugins from NPM now.

As an example, you need to source your splashscreen plugin as cordova-plugin-splashscreen. The entry in config.xml would look like this:

<gap:plugin name="cordova-plugin-splashscreen" version="2.1.0" source="npm" />

NOTE, the the different spelling for the name, and the higher version number.

Update: 2016-02-11 As of 19 Nov, 2015, the statement is not longer true. You can use either <plugin (...)> or <gap:plugin (...)>. See the blog post for details. ALSO, if you are using Phonegap Build, then the examples I am giving you are okay. If you are using Cordova CLI or Phonegap CLI, you do not use gap:plugin.

If you are using a CLI, then read 6. again - it has the answer on how to use versions with plugins. But be aware, her examples are for the non-NPM, so the correct names are in NPM repository from now on.

One last thing, I have no way to check your images. So, you MAY not get the splash screens to show up. I have a demo you can check here: Phonegap-Splashscreen-Test. However, it is built on version phonegap-version=3.5.0. So, you can check your file paths and names, but not the code. Also, that code repository has notes on why the filenames need to be what they are.

I know some of this is confusing, so just make the changes, then we might need to walk through it again.

Best of Luck



来源:https://stackoverflow.com/questions/33053190/splash-screen-is-not-display-after-build-on-phonegap-version-cli-5-2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!