离子图标和启动画面未显示

时间:2017-06-02 08:19:03

标签: cordova ionic-framework ionic2 cordova-plugins ionic3

我正在使用Ionic3。我正在尝试为我的应用创建自定义图标和启动画面。我在icon.png文件夹中创建了splash.png(432x193)和resources(6135x2733)。

然后我跑了:

ionic cordova resources
✔ Collecting resource configuration and source images - done!
✔ Uploading source images to prepare for transformations - done!
✔ Generating platform resources: 38 / 38 complete - done!
✔ Modifying config.xml to add new image resources - done!

如果我查看resources/android/icon

enter image description here

resources/android/splash

enter image description here

我可以看到新图像已生成(我有<preference name="orientation" value="portrait"/>,所以我认为这就是为什么只生成肖像图像,横向具有默认的离子图像。)

我也检查:

config.xml中

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.thewhozoo912107" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>theWhoZoo</name>
    <description>An awesome Ionic/Cordova app.</description>
    <author email="admin@thewhozoo.com" href="http://thewhozoo.com/">theWhoZoo Team</author>
    <content src="index.html"/>
    <access origin="*"/>
    <allow-intent href="http://*/*"/>
    <allow-intent href="https://*/*"/>
    <allow-intent href="tel:*"/>
    <allow-intent href="sms:*"/>
    <allow-intent href="mailto:*"/>
    <allow-intent href="geo:*"/>
    <allow-intent href="*"/>
    <platform name="android">
        <allow-intent href="market:*"/>
        <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
        <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
        <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
        <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
        <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
        <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
        <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
        <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
        <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
        <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
        <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
        <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*"/>
        <allow-intent href="itms-apps:*"/>
        <icon src="resources/ios/icon/icon.png" width="57" height="57"/>
        <icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
        <icon src="resources/ios/icon/icon-40.png" width="40" height="40"/>
        <icon src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
        <icon src="resources/ios/icon/icon-40@3x.png" width="120" height="120"/>
        <icon src="resources/ios/icon/icon-50.png" width="50" height="50"/>
        <icon src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
        <icon src="resources/ios/icon/icon-60.png" width="60" height="60"/>
        <icon src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
        <icon src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
        <icon src="resources/ios/icon/icon-72.png" width="72" height="72"/>
        <icon src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
        <icon src="resources/ios/icon/icon-76.png" width="76" height="76"/>
        <icon src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
        <icon src="resources/ios/icon/icon-83.5@2x.png" width="167" height="167"/>
        <icon src="resources/ios/icon/icon-small.png" width="29" height="29"/>
        <icon src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
        <icon src="resources/ios/icon/icon-small@3x.png" width="87" height="87"/>
        <splash src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" height="1136"/>
        <splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/>
        <splash src="resources/ios/splash/Default-736h.png" width="1242" height="2208"/>
        <splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
        <splash src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" height="2732"/>
        <splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
        <splash src="resources/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
        <splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/>
    </platform>
    <allow-navigation href="*"/>
    <preference name="webviewbounce" value="false"/>
    <preference name="UIWebViewBounce" value="false"/>
    <preference name="DisallowOverscroll" value="true"/>
    <preference name="android-minSdkVersion" value="16"/>
    <preference name="BackupWebStorage" value="none"/>
    <preference name="SplashMaintainAspectRatio" value="true"/>
    <preference name="FadeSplashScreenDuration" value="300"/>
    <preference name="loadUrlTimeoutValue" value="700000"/>
    <preference name="orientation" value="portrait"/>
    <preference name="SplashScreen" value="screen"/>
    <preference name="SplashScreenDelay" value="3000"/>
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar"/>
    </feature>
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
    <plugin name="cordova-plugin-whitelist" spec="1.3.1"/>
    <plugin name="cordova-plugin-console" spec="1.0.5"/>
    <plugin name="cordova-plugin-statusbar" spec="2.2.1"/>
    <plugin name="cordova-plugin-device" spec="1.1.4"/>
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.1"/>
    <plugin name="cordova-plugin-facebook4" spec="~1.7.4">
        <variable name="APP_ID" value="XXXXXXXXXX"/>
        <variable name="APP_NAME" value="theWhoZoo"/>
    </plugin>
    <plugin name="cordova-plugin-googleplus" spec="~5.1.1">
        <variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.XXXXXXXXXXXXXXXXXXX"/>
    </plugin>
    <plugin name="cordova-plugin-crop" spec="~0.3.1"/>
    <plugin name="cordova-plugin-app-version" spec="~0.1.9"/>
</widget>
然后我跑了:

ionic cordova build android

构建apk文件。当我在Android设备上安装此apk时,图标和启动画面仍然是相同的默认Cordova图像:

enter image description here

如果有人可以提供帮助,我将不胜感激。

更多信息:

global packages:

    @ionic/cli-utils : 1.3.0
    Cordova CLI      : 6.4.0 
    Ionic CLI        : 3.3.0

local packages:

    @ionic/app-scripts              : 1.3.0
    @ionic/cli-plugin-cordova       : 1.3.0
    @ionic/cli-plugin-ionic-angular : 1.3.0
    Cordova Platforms               : android 6.0.0 ios 4.3.1
    Ionic Framework                 : ionic-angular 3.2.1

System:

    Node       : v7.10.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : not installed
    ios-sim    : not installed

2 个答案:

答案 0 :(得分:2)

看起来旧版Cordova中存在一个错误。我做了一些阅读,以下解决了这个问题:

ionic cordova platform rm android
ionic cordova platform add android@latest
ionic cordova resources
ionic cordova build android

您可能还需要:

npm install -g cordova@latest

然而,这似乎只是部分解决了这个问题。该图标现在是我的自定义图标,但启动画面只是白色。

答案 1 :(得分:0)

  1. 转到apps res目录:
  2.   

    C:\用户\你\ YourApk \平台\机器人\ RES

    1. 逐个打开所有文件夹,并用相同尺寸的Apps图标替换cordova app图标的图标/图像。
    2. - C:\Users\You\YourApk\platforms\android\res\drawable
      - C:\Users\You\YourApk\platforms\android\res\drawable-hdpi
      - C:\Users\You\YourApk\platforms\android\res\drawable-land-hdpi
      - C:\Users\You\YourApk\platforms\android\res\drawable-ldpi
      - C:\Users\You\YourApk\platforms\android\res\drawable-mdpi
      - C:\Users\You\YourApk\platforms\android\res\drawable-xhdpi
      
      1. 然后构建您的应用程序
      2. 如果没有,some blog with extras

        如果标准方法不起作用,我会将该博客的指南发布到这个答案中。