質問

I've set the splash screens in config.xml and even copied them over manually in the platforms/android/res/drawable-RESOLUTIONS/splash.png

However, building it using the command line phonegap local build android --device shows me no splash screen. only a blank white screen for about a second.

it's also damn weird that the icons and splash screens don't get copied over in the build folder. I have to manually copy them there. Is this a known bug?

Folder Structure: http://cl.ly/image/091v0D2o2s3O

my config.xml:

<preference name="permissions"                value="none"/>

<!-- Customize your app and platform with the preference element. -->
<!-- <preference name="phonegap-version"      value="3.4.0" /> -->      <!-- all: current version of PhoneGap -->
<preference name="orientation"                value="default" />        <!-- all: default means both landscape and portrait are enabled -->
<preference name="target-device"              value="universal" />      <!-- all: possible values handset, tablet, or universal -->
<preference name="fullscreen"                 value="true" />           <!-- all: hides the status bar at the top of the screen -->
<preference name="webviewbounce"              value="true" />           <!-- ios: control whether the screen 'bounces' when scrolled beyond the top -->
<preference name="prerendered-icon"           value="true" />           <!-- ios: if icon is prerendered, iOS will not apply it's gloss to the app's icon on the user's home screen -->
<preference name="stay-in-webview"            value="false" />          <!-- ios: external links should open in the default browser, 'true' would use the webview the app lives in -->
<preference name="ios-statusbarstyle"         value="black-opaque" />   <!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar -->
<preference name="detect-data-types"          value="true" />           <!-- ios: controls whether data types (such as phone no. and dates) are automatically turned into links by the system -->
<preference name="exit-on-suspend"            value="false" />          <!-- ios: if set to true, app will terminate when home button is pressed -->
<preference name="show-splash-screen-spinner" value="true" />           <!-- ios: if set to false, the spinner won't appear on the splash screen during app loading -->
<preference name="auto-hide-splash-screen"    value="false" />           <!-- ios: if set to false, the splash screen must be hidden using a JavaScript API -->
<preference name="disable-cursor"             value="false" />          <!-- blackberry: prevents a mouse-icon/cursor from being displayed on the app -->
<preference name="android-minSdkVersion"      value="7" />              <!-- android: MIN SDK version supported on the target device. MAX version is blank by default. -->
<preference name="android-installLocation"    value="auto" />           <!-- android: app install location. 'auto' will choose. 'internalOnly' is device memory. 'preferExternal' is SDCard. -->
<preference name="SplashScreenDelay" value="500000" />
<preference name="splash-screen-duration" value="500000" />
<!-- Plugins can also be added here. -->
<!--
    <gap:plugin name="Example" />
    A list of available plugins are available at https://build.phonegap.com/docs/plugins
-->

<!-- Define app icon for each platform. -->
<icon src="icon.png" />
<icon src="res/icon/android/icon-36-ldpi.png"   gap:platform="android"    gap:density="ldpi" />
<icon src="res/icon/android/icon-48-mdpi.png"   gap:platform="android"    gap:density="mdpi" />
<icon src="res/icon/android/icon-72-hdpi.png"   gap:platform="android"    gap:density="hdpi" />
<icon src="res/icon/android/icon-96-xhdpi.png"  gap:platform="android"    gap:density="xhdpi" />
<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" />

<!-- Define app splash screen for each platform. -->
<gap:splash src="splash.png" />
<gap:splash src="res/screen/android/screen-ldpi-portrait.png"  gap:platform="android" gap:density="ldpi" />
<gap:splash src="res/screen/android/screen-mdpi-portrait.png"  gap:platform="android" gap:density="mdpi" />
<gap:splash src="res/screen/android/screen-hdpi-portrait.png"  gap:platform="android" gap:density="hdpi" />
<gap:splash src="res/screen/android/screen-xhdpi-portrait.png" gap:platform="android" gap:density="xhdpi" />
<gap:splash src="res/screen/ios/Default~iphone.png"    gap:platform="ios"     width="320" height="480" />
<gap:splash src="res/screen/ios/Default@2x~iphone.png" gap:platform="ios"     width="640" height="960" />
<gap:splash src="res/screen/ios/Default-Portrait~ipad.png"      gap:platform="ios"     width="768" height="1024" />
<gap:splash src="res/screen/ios/Default-Landspace~ipad.png"     gap:platform="ios"     width="1024" height="768" />
役に立ちましたか?

解決 2

Unless it has chaged, the gap:splash lines in config.xml and the files in the res folder are only for phonegap build.

You need to add the splashscreen plugin org.apache.cordova.splashscreen to your project and copy the files in the native folders as you did.

他のヒント

Based on the latest documentation of Phonegap 3.5.0, http://docs.phonegap.com/en/3.5.0/config_ref_images.md.html

First, you need to add splashscreen plugin. Using your CLI, go to your project directory and do this :

cordova plugin add org.apache.cordova.splashscreen

After that, add this to config.xml in the root destination or in www/config.xml(old version)

<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="10000" />

and place your splash screen file to the corresponding drawable folder according to size, like you just did. Make sure the file name is same with the one with the "value" parameter.

Next, browse to

platform/android/ant-build

and delete all the files inside it (most important step). Last but not least, build and run your phonegap project. Now it will use the new splash screen file.

It seems like the ant-build is not updating itself.

I solved the problem by adding default splash tag in config.xml file

Add this to config.xml in the root destination or in www/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" />

It's mention on Phonegap docs:-

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top