I have a flex application written using flex builder. When I
build it and run it using flex builder, or create an air file from
flex builder and run that, then my application works just fine.
However, I would like people without copies of flexBuilder
installed to be able to build my application, so I am using the
flex ant task (flex-mxmlc) to build my application. As far as I can
tell I have the same configuration, and the same libraries included
in the ant task. However, when I run the air file generated by the
ant task nothing happens. If you look in the task manager, you can
see that the application is running, but the main window for the
application never appears.
I tried running the swf through a debug version of flash to
get some log output, and I am getting a bunch of exceptions, the
first of which is:
VerifyError: Error #1014: Class flash.display::NativeWindow
could not be found.
It seems like it might not be finding the main flex library
(flexlib.swc), is that where that class would be? In my ant task I
have an include-libraries tag that points to that file.
I experienced a similar problem (although the class that
could not be found was different for me). Googling around I found
someone who had a similar problem and claimed that using the
flexlib.swc library was the culprit.
The root of the problem is that the Flex SDK that comes
bundled with the Flex Builder has libraries (under frameworks/libs)
that are NOT included in plain free Flex SDK that you and I are
presumably using on our build machines.
When flexlib.swc is linked in, it causes certain classes to
be required at runtime. Apparently when you compile these classes
are linked in if available, but when they are not the compilation
still succeeds. Only you get a VerifyError when you run the thing.
What worked for me was to copy all the additional .swc files
found in my Flex Builder SDK's frameworks/libs directory to the
same directory on my build machine. Also you will need to copy the
additional files under frameworks/locale/en_US.
Rebuild and clear your browser's cache and it should then