【发布时间】:2015-05-27 10:27:47
【问题描述】:
当我使用 Phonegap Build 构建应用程序时,我遇到的问题是 android 和 ios 图标未正确包含。
config.xml部分如下:
<icon src="www/res/icon/icon.png" />
<splash src="www/res/screen/splash.jpg" />
<platform name="android">
<icon src="www/res/icon/android/icon-ldpi.png" density="ldpi" />
<icon src="www/res/icon/android/icon-mdpi.png" density="mdpi" />
<icon src="www/res/icon/android/icon-hdpi.png" density="hdpi" />
<icon src="www/res/icon/android/icon-xhdpi.png" density="xhdpi" />
<splash gap:qualifier="port-hdpi" src="www/res/screen/android/screen-hdpi-port.png" width="480" height="800" />
<splash gap:qualifier="port-xhdpi" src="www/res/screen/android/screen-xhdpi-port.png" width="640" height="960" />
<splash gap:qualifier="land-hdpi" src="www/res/screen/android/screen-hdpi-land.jpg" width="800" height="480" />
<splash gap:qualifier="land-xhdpi" src="www/res/screen/android/screen-xhdpi-land.jpg" width="960" height="640" />
</platform>
<platform name="ios">
<!-- iOS 7.0+ -->
<!-- iPhone / iPod Touch -->
<icon src="www/res/icon/ios/icon-60.png" width="60" height="60" />
<icon src="www/res/icon/ios/icon-60@2x.png" width="120" height="120" />
<icon src="www/res/icon/ios/icon-60@3x.png" width="180" height="180" />
<!-- iPad -->
<icon src="www/res/icon/ios/icon-76.png" width="76" height="76" />
<icon src="www/res/icon/ios/icon-76@2x.png" width="152" height="152" />
<!-- iOS 6.1 -->
<!-- Spotlight Icon -->
<icon src="www/res/icon/ios/icon-40.png" width="40" height="40" />
<icon src="www/res/icon/ios/icon-40@2x.png" width="80" height="80" />
<!-- iPhone / iPod Touch -->
<icon src="www/res/icon/ios/icon.png" width="57" height="57" />
<icon src="www/res/icon/ios/icon@2x.png" width="114" height="114" />
<!-- iPad -->
<icon src="www/res/icon/ios/icon-72.png" width="72" height="72" />
<icon src="www/res/icon/ios/icon-72@2x.png" width="144" height="144" />
<!-- iPhone Spotlight and Settings Icon -->
<icon src="www/res/icon/ios/icon-small.png" width="29" height="29" />
<icon src="www/res/icon/ios/icon-small@2x.png" width="58" height="58" />
<!-- iPad Spotlight and Settings Icon -->
<icon src="www/res/icon/ios/icon-50.png" width="50" height="50" />
<icon src="www/res/icon/ios/icon-50@2x.png" width="100" height="100" />
<!-- Splash sreens -->
<splash src="www/res/screen/ios/screen-iphone-portrait-2x.png" height="960" width="640" />
<splash src="www/res/screen/ios/screen-iphone-landscape-2x.jpg" height="640" width="960" />
<splash src="www/res/screen/ios/screen-iphone-portrait-568h-2x.png" height="1136" width="640" />
<splash src="www/res/screen/ios/screen-iphone-landscape-568h-2x.jpg" height="640" width="1136" />
<splash src="www/res/screen/ios/screen-ipad-portrait.png" height="1024" width="768" />
<splash src="www/res/screen/ios/screen-ipad-landscape.jpg" height="768" width="1024" />
</platform>
<platform name="wp8">
<icon src="www/res/icon/wp/ApplicationIcon.png" width="99" height="99" />
<!-- tile image -->
<icon src="www/res/icon/wp/Background.png" width="159" height="159" />
<splash src="www/res/screen/wp/SplashScreenImage.png" width="768" height="1280"/>
</platform>
这些文件确实存在于上述文件夹中,它们甚至分别出现在 assets/www/res 和 payload/myApp.app/www/res 的 apk 和 ipa 中。但是 phonegap build 不会将它们复制到 res/drawable-* 或 payload/myApp.app。相反,它使用默认图标和闪屏(Android 中的 Cordova bot 和 iOS 中的透明图像)。
在本地完成的 WP8 构建就像一个魅力。 我已经在Phonegap Build中删除了该应用并重新创建了它,但没有更改图标,只是应用ID现在高了一点。
是不是必须把图标放在特殊位置,还是config.xml有问题?
更新:我刚刚查看了 iOS 构建的调试输出。一些PNG被复制,但ipa仍然包含Payload\MyApp.app中的透明图标。复制日志示例:
CopyPNGFile build/MyApp.app/icon-76.png MyApp/Resources/icons/icon-76.png
cd /project
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng -compress /project/MyApp/Resources/icons/icon-76.png /project/build/MyApp.app/icon-76.png
安卓也是如此:
[crunch] Processing image to cache: /project/res/drawable-hdpi/icon.png => /project/bin/res/drawable-hdpi/icon.png
[crunch] (processed image to cache entry /project/bin/res/drawable-hdpi/icon.png: 67% size of source)
好吧,我确实在 config.xml 中定义了其他目录/文件!
【问题讨论】:
标签: android ios cordova phonegap-build