I do a lot with Phonegap, but there's an issue I've been having lately that has been driving me a bit mad... The file size of my finished IPA and APK files is getting out of hand.
The problem, as far as I can see, is that we're required to include a lot of images, some of which are expected to be high quality -- even moreso for Retina devices where the resolution is doubled. Here, let me illustrate the problem:
This is a graphical representation of file sizes inside my compiled iPhone/iPad application (generated with Disk Inventory X). The compiled IPA weighs in at a massive 23.4mb.
- The purple blocks are images
- The blocks inside the yellow outline are the vast majority of the code & other resources I've written and included in my app, including font files which I'm including so that I can use custom fonts in my application. (The fonts are the bright pink blocks inside the yellow outline.)
- The red block in the upper right and the green block in the lower left are the .bundle file and the executable, respectively.
It's obvious that the problem here is images.
Why do I have so many large images?
That behemoth in the bottom left corner is the splash screen for Retina iPads. It weighs in at a hefty 6.6mb, and that's after I've run it through some compression and optimization software to try and reduce its size without too much loss of quality.
But the odd thing is: So is the image in the upper-left. That is the file I include in my zip to PhoneGap:Build, and it is only 3.4mb. Based on its dimensions when compared side-by-side, it has to be a copy of my Retina iPad splash screen file... but why is it so huge after they copy and rename it? I'm guessing this is an issue with PhoneGap:Build...
The three large purple blocks along the right side are also copies of other splash screens: OG iPad Landscape, Retina iPhone5, and Retina iPhone 4.
This leads me to wonder if perhaps placing these images in the root of my application, with the appropriate names, would avoid the file copying and keep file size down... It would still be a little large for my tastes, but if my eyeballing is even remotely close, it would cut the total file size roughly in half, which would be a great start.
Android APK files built on PhoneGap:Build tend to have the same issues, just (so far) to a lesser extent. My current APK build for the same app weighs in at 10.9mb.
I'll report back with my findings, but for now, that's all I know.