在 phonegap 版本 cli 5.2.0 上构建后不显示启动画面
Splash screen is not display after build on phonegap version cli 5.2.0
我已经为 phonegap 应用程序制作了闪屏,但升级后我的闪屏不显示我在 cofig 文件中编写了如下代码,并且我还根据 phonegap 闪屏文档添加了屏幕。我还在项目中添加了默认屏幕图像。
<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>
我与 phonegap 应用程序的升级有什么关系。
@vatsal,
好吧,你有很多 Cordova/Phonegap.
新开发者常犯的错误
首先阅读本文档中的 BOLD 点,因为您需要先修复您的问题,然后再获取更详细的信息。
Top Mistakes by Developers new to Cordova/Phonegap
您要做的第一件事是为您的编译器设置一个版本。为此,请阅读
6。没有为你的编译器设置 "phonegap version"
我引用
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,你运气不好。这样做不会修复错误,但这很重要。您可以稍后阅读整个文档以获得更好的理解。
下一件事 从现在开始您需要从 NPM 获取 ALL your core plugins。并确保为此设置版本。为此阅读
11。您现在需要从 NPM 获取插件。
例如,您需要将启动画面插件作为 cordova-plugin-splashscreen
来源。 config.xml 中的条目将如下所示:
<gap:plugin name="cordova-plugin-splashscreen" version="2.1.0" source="npm" />
注意,名称的不同拼写和更高的版本号。
更新:2016-02-11 截至 2015 年 11 月 19 日,该声明不再正确。您可以使用 <plugin (...)>
或 <gap:plugin (...)>
。有关详细信息,请参阅 blog post。
此外,如果您使用的是 Phonegap Build,那么我给您的示例就可以了。如果您使用的是 Cordova CLI 或 Phonegap CLI,则不要使用 gap:plugin
.
如果您使用的是 CLI,请再次阅读 6. - 它提供了有关如何使用带有插件的版本的答案。但请注意,她的示例是针对非 NPM 的,因此从现在开始,正确的名称在 NPM repository 中。
最后一件事,我无法检查您的图像。因此,您可能无法显示启动画面。我有一个演示,您可以在此处查看:Phonegap-Splashscreen-Test。但是,它是基于版本 phonegap-version=3.5.0
构建的。因此,您可以检查文件路径和名称,但不能检查代码。此外,该代码存储库还说明了为什么文件名需要保持原样。
我知道其中有些令人困惑,所以只需进行更改,然后我们可能需要再次检查它。
祝你好运
我已经为 phonegap 应用程序制作了闪屏,但升级后我的闪屏不显示我在 cofig 文件中编写了如下代码,并且我还根据 phonegap 闪屏文档添加了屏幕。我还在项目中添加了默认屏幕图像。
<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>
我与 phonegap 应用程序的升级有什么关系。
@vatsal,
好吧,你有很多 Cordova/Phonegap.
首先阅读本文档中的 BOLD 点,因为您需要先修复您的问题,然后再获取更详细的信息。
Top Mistakes by Developers new to Cordova/Phonegap
您要做的第一件事是为您的编译器设置一个版本。为此,请阅读
6。没有为你的编译器设置 "phonegap version"
我引用
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,你运气不好。这样做不会修复错误,但这很重要。您可以稍后阅读整个文档以获得更好的理解。
下一件事 从现在开始您需要从 NPM 获取 ALL your core plugins。并确保为此设置版本。为此阅读
11。您现在需要从 NPM 获取插件。
例如,您需要将启动画面插件作为 cordova-plugin-splashscreen
来源。 config.xml 中的条目将如下所示:
<gap:plugin name="cordova-plugin-splashscreen" version="2.1.0" source="npm" />
注意,名称的不同拼写和更高的版本号。
更新:2016-02-11 截至 2015 年 11 月 19 日,该声明不再正确。您可以使用 <plugin (...)>
或 <gap:plugin (...)>
。有关详细信息,请参阅 blog post。
此外,如果您使用的是 Phonegap Build,那么我给您的示例就可以了。如果您使用的是 Cordova CLI 或 Phonegap CLI,则不要使用 gap:plugin
.
如果您使用的是 CLI,请再次阅读 6. - 它提供了有关如何使用带有插件的版本的答案。但请注意,她的示例是针对非 NPM 的,因此从现在开始,正确的名称在 NPM repository 中。
最后一件事,我无法检查您的图像。因此,您可能无法显示启动画面。我有一个演示,您可以在此处查看:Phonegap-Splashscreen-Test。但是,它是基于版本 phonegap-version=3.5.0
构建的。因此,您可以检查文件路径和名称,但不能检查代码。此外,该代码存储库还说明了为什么文件名需要保持原样。
我知道其中有些令人困惑,所以只需进行更改,然后我们可能需要再次检查它。
祝你好运