Quick AIR Tip - including an icon with your application

This post is more than 2 years old.

A few nights ago I was working on a personal AIR project and wanted to include an icon with it. This was - so I thought - rather easy. I found a nice icon, saved it into an assets folder, and then edited mything-app.xml:

<icon> <image16x16></image16x16> <image32x32></image32x32> <image48x48></image48x48> <image128x128>assets/strogg128.png</image128x128> </icon>

Generating the AIR file though threw an odd error:

Um, yeah, that's nice and verbose, thanks. After some googling I knew it was icon related (and could confirm by rolling back my change to the XML file), but I couldn't figure out what was wrong. I tried moving the icon around, and tried different paths, but nothing worked.

Finally, Mike Chambers helped me out and pointed out the issue. Turns out when I have picked an icon I had only set a 128x128 icon. I was too lazy to resize the icon. Well AIR didn't like that. It thought I had specified icons for all sizes, but had used blank values for the other three sizes. This is what made AIR throw a fit. Personally I think that's a bit silly. If the value exists, but is blank, it should be treated like a null, but whatever. It was certainly non obvious to me, and I appreciate Mike helping me out. The fix I used (at first, I did end up making smaller sized icons) was to simply surround the 3 XML entries for the other icons with a comment:

<icon> <!-- <image16x16></image16x16> <image32x32></image32x32> <image48x48></image48x48> --> <image128x128>assets/strogg128.png</image128x128> </icon>

Woot. That made it build. I did end up with an issue with my 48x48 icon. Maybe I resized my graphic wrong, but I ended up not being able to build until I kept that one commented out, but I figure supporting 3 of the 4 sizes is enough for an application that will have a grand total of one user.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com