Figure out why app size becomes large

I've made a very simple and tiny app called Pace Calculator. Since it's so simple and I want to support as much as possible, it only relies on API 1.2.0. I use SDK version 6.4.2.

I noticed that the size for the app is listed as a whopping 4MB which sounds crazy given that the whole codebase is ~170kb (source here). This also means that a lot of devices can't install it due to size limitations.

I'm building an optimized version with monkey-c-optimizer. Could this be due to supporting so many devices (128)? How can I see what's causing this?

  • are you looking at the prg or the iq file size?

  • I’m looking at the size Connect IQ reports. This is once installed so it should be the size of the actual app. The compiled iq file is ~150MB

  • That's indeed huge.

    Judged by the source in github this shouldn't be more than 10-20kb per device.

    Except... 147kb: speed.png

    I would remove this from resources, you surely don't neeed that file, or if you do then include a smaller size one. But it might be that it's not even included in the prg if it's not referenced. But better to only include stuff that you actually need in resources/

  • Removed speed.png and now use the the 65x65 image as icon (4KB). In total source + resources is 23,7KB. I tried exporting it with the regular plugin (not the optimizer) and the .iq file comes out at 4MB which is also the size Connect IQ reports in the app after reinstalling the latest version.

    So I don't think an of the pictures here is the problem. Even with speed.png still in use that's only 147KB and shouldn't result in a 4MB big app.

  • Png is compressed, the default drawable probably isn't so it could blow it up a bit, but I don't think either that it's 4mb.

    If you rename the iq extension to zip you can go inside and see each prg file. How many part numbers are there and what is the size of one prg?

  • When you update the store with a new version, it may take a bit of time before that new version ends up in the watch.  I typically see maybe 15 minutes before The CIQ mobile app does the update, but can take up to a couple hours.  You could still be looking at the last version

  • How many part numbers are there and what is the size of one prg?

    There are 270 folders. Each prg is between 7-16KB.

    When you update the store with a new version, it may take a bit of time before that new version ends up in the watch.

    Ah, good to know, and kinda expected given how most Connect IQ things work. Slight smile But even so, I wouldn't expect the original version I got user feedback on to be 4MB, or the version I built yesterday, even though I still had the 150KB file in there.

    I'll wait for a while until I can confirm the app lists the latest version as installed.

  • Ok it seems like I was wrong. Even though the image isn't used, having it as a drawable in drawables.xml is definitely the cause here. I don't know why, but having that one even without using it makes a lot of the prgs ~950KB each but often just ~120KB. The complete iq file becomes 150MB though. I can't find any single prg being 4MB though so not sure what that's coming from?

    By simply removing the line from the XML makes the iq file end up at ~3MB and the installed version (on my device) is 25KB.

    I wonder if this is a bug worth reporting. It makes no sense for the compiled prg for a single device to become 4MB just because you include a file at 150KB. I can think of other apps with custom fonts and other resources reaching 150KB without being extreme.

    Do you think this is a normal behavior or something worth bug reporting?

    Thank you for the help, in this case it solves my problem but I don't know how I would solve this if I actually needed 150KB of resources which doesn't sound that weird in my opinion given the current generation of devices.

  • Just a guess, but were any svg files involved?

  • I have an svg file in resources/drawables but it was never a part of the XML. I still have the files in the directory, I just had to remove the reference from the XML

    -     <bitmap id="SpeedIcon" filename="speed.png" />