What must I do to change default Phonegap icon when using the phonegap Build service

自古美人都是妖i 提交于 2019-12-12 01:46:55

问题


I have followed the instructions for replacing the phonegap icon. I have dutifully created properly sized icons and put them in the root folder. I visually verified that mine are the only ones that exist in the project verified the links in the config.xml point to the proper file. I then zip up the project and send it to phoneGap build AND STILL I GET THE DEFAULT ICONS.

I verified this is happening whether I download via my phone or pull down the apk. The default icon is there, taunting me in the andriod build...

In the ios package, the icons are all blank. my app is here: https://build.phonegap.com/apps/1413267/share

my config

     <widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.mbienergyservices.careers" version="1.0.6">
  <name>MBI Works! v1.0.6</name>
  <description>Search and apply at MBI</description>
  <author href="http://mbienergyservices.com" email="support@mbienergyservices.com">James Fleming</author>
  <content src="index.html"/>
  <preference name="phonegap-version" value="3.7.0" />
  <preference name="permissions" value="none"/>
  <preference name="orientation" value="default"/>
  <preference name="target-device" value="universal"/>
  <preference name="fullscreen" value="true"/>
  <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="7"/>
  <preference name="android-installLocation" value="auto"/>

 <icon src="icon.png"/>
  <!-- iPhone 6 / 6+ -->
    <icon src="icon-60@3x.png" gap:platform="ios" width="180" height="180" />
    <!-- iPhone / iPod Touch  -->
    <icon src="icon-60.png" gap:platform="ios" width="60" height="60" />
    <icon src="icon-60@2x.png" gap:platform="ios" width="120" height="120" />
    <!-- iPad -->
    <icon src="icon-76.png" gap:platform="ios" width="76" height="76" />
    <icon src="icon-76@2x.png" gap:platform="ios" width="152" height="152" />
    <!-- Settings Icon -->
    <icon src="icon-small.png" gap:platform="ios" width="29" height="29" />
    <icon src="icon-small@2x.png" gap:platform="ios" width="58" height="58" />
    <!-- Spotlight Icon -->
    <icon src="icon-40.png" gap:platform="ios" width="40" height="40" />
    <icon src="icon-40@2x.png" gap:platform="ios" width="80" height="80" />
  <!-- iOS 6.1 -- > 
      <!-- iPhone / iPod Touch -->  
      <icon src="icon-57.png" gap:platform="ios" width="57" height="57"/> 
      <!-- iPad -->
      <icon src="icon-72.png" gap:platform="ios" width="72" height="72"/>
      <icon src="icon-72-2x.png" gap:platform="ios" width="144" height="144"/>
      <!-- iPhone Spotlight and Settings Icon -->
      <icon src="icon-small.png" gap:platform="ios" width="29" height="29" />
      <icon src="icon-small@2x.png" gap:platform="ios" width="58" height="58" />
       <!-- iPad Spotlight and Settings Icon -->
      <icon src="icon-50.png" gap:platform="ios" width="50" height="50" />
      <icon src="icon-50@2x.png" gap:platform="ios" width="100" height="100" />
  <!-- android --> 
    <icon src="mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
    <icon src="hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
    <icon src="xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
    <icon src="xxhdpi.png" gap:platform="android" gap:qualifier="xxhdpi" />

    <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="splash.png" />

  <gap:splash src="screen-ldpi-portrait.png" gap:platform="android" gap:qualifier="port-ldpi"/>
  <gap:splash src="screen-mdpi-portrait.png" gap:platform="android" gap:qualifier="port-mdpi"/>
  <gap:splash src="screen-hdpi-portrait.png" gap:platform="android" gap:qualifier="port-hdpi"/>
  <gap:splash src="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="screen-iphone-portrait.png" gap:platform="ios" width="320" height="480"/>
  <gap:splash src="screen-iphone-portrait-2x.png" gap:platform="ios" width="640" height="960"/>
  <gap:splash src="screen-iphone-portrait-568h-2x.png" gap:platform="ios" width="640" height="1136"/>
  <gap:splash src="screen-ipad-portrait.png" gap:platform="ios" width="768" height="1024"/>
  <gap:splash src="screen-ipad-landscape.png" gap:platform="ios" width="1024" height="768"/>
  <access origin="*" subdomains="true" />
</widget>

回答1:


It seems that the issue is that the Index.html file must be in the root when using phonegap build, otherwise, you get the default icons.

I have no idea as to why this might be the case, as the icons are not referenced in the index.html file at all, but I verified this behavior.

Put the index.html in the root, the icons appear as expected, put the index.html in the www folder and get the default cordova icons.

Weird.




回答2:


From the official documentation

The following configuration can be used to define single default icon which will be used for all platforms.

<icon src="res/icon.png" />

Please notice that icons should be in the res folder, not www\res.

As of Cordova 3.6 you could specify icons for the individual platforms separately. For example:

<platform name="android">
    <icon src="res/android/ldpi.png" density="ldpi" />
    <icon src="res/android/mdpi.png" density="mdpi" />
    <icon src="res/android/hdpi.png" density="hdpi" />
    <icon src="res/android/xhdpi.png" density="xhdpi" />
</platform>

From PhoneGap Build service documentation about icons

The default icon must be named icon.png and must reside in the root of your application folder.

<icon src="icon.png" />

For iOS specific icons for example use following snippet.

 <icon src="icon-60@3x.png" gap:platform="ios" width="180" height="180" />


来源:https://stackoverflow.com/questions/29687909/what-must-i-do-to-change-default-phonegap-icon-when-using-the-phonegap-build-ser

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