Error 303 for embedded icons in AIR apps

If you are using the same icon file in your app.xml file in AIR and embedding it to set it dynamically at runtime (for example if you have several icons that you switch between) then you'll most likely get the following error:

Error creating AIR file: YourApp-app.xml(94): error 303: Icon assets/icon.png is missing from the package.

The Copy non-embedded assets setting in compiler preferences doesn't help you here because you are embedding the icons in order to dynamically switch the application icon at runtime.

The easiest workaround I found was to simply duplicate the icons I wanted to use in the app.xml file (e.g., if my dynamic icon was called icon.png, I simply made a copy called icon-static.png).

Crude, yes. Effective, yes :)