I am new to AdobeAir. I started with helloworld app by just following the following link.
http://help.adobe.com/en_US/air/build/WS144092a96ffef7cc4c0afd1212601c9a36f-8000.html
I am able to compile HelloWorld.mxml file successfully, but i am not able to run the app by following command adl HelloWorld-app.xml . the error message says .. error while loading initial content.
Also I am attaching the HelloWorld-app.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/air/application/1.0">
<id>samples.flex.HelloWorld</id>
<version>0.1</version>
<filename>HelloWorld</filename>
<initialWindow>
<content>HelloWorld.swf</content>
<visible>true</visible>
<systemChrome>none</systemChrome>
<transparent>true</transparent>
<width>400</width>
<height>200</height>
</initialWindow>
</application>
and HelloWorld.mxml is
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://`enter code here`ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
title="Hello World">
<s:Label text="Hello AIR" horizontalCenter="0" verticalCenter="0"/>
</s:WindowedApplication>
Please help me.
The AIR namespace number found in xmlns
is only half the story. That defines the minimum runtime version required to display the content. The other half of the story is what -swf-version
was the content compiled with.
If the SWF is compiled with a newer -swf-version
than the AIR adl can handle, you'll get the
"error while loading initial content" message.
I picked up this table from another answer and added AIR version info (source):
SWF Version | Flash Player Version | AIR Version
---------------+------------------------+---------------
9 | 9.0.115.0 | N/A
10 | 10.0, 10.1 | 1.5, 2.0
11 | 10.2 | 2.6
12 | 10.3 | 2.7
13 | 11.0 | 3
14 | 11.1 | 3.1
15 | 11.2 | 3.2
16 | 11.3 | 3.3
17 | 11.4 | 3.4
18 | 11.5 | 3.5
19 | 11.6 | 3.6
20 | 11.7 | 3.7
21 | 11.8 | 3.8
22 | 11.9 | 3.9
23 | 12 | 4
24 | 13 | 13
25 | 14 | 14
26 | 15 | 15
27 | 16 | 16
28 | 17 | 17
29 | 18 | 18
30 | 19 | 19
31 | 20 | 20
32 | 21 | 21
33 | 22 | 22
34 | 23 | 23
35 | 24 | 24
36 | 25 | 25
37 | 26 | 26
38 | 27 | 27
39 | 28 | 28
40 | 29 | 29
41 | 30 | 30
42 | 31 | 31
You can determine the -swf-version
of a SWF file using the swfdump
utility included in the Flex and AIR SDKs.
> swfdump example.swf | grep -i '<swf'
<swf xmlns='http://macromedia/2003/swfx' version='18' framerate='24' size='10000x7500' compressed='false' >
The above SWF is compiled with -swf-version=18
and hence will require AIR 3.5 or newer, and xmlns="http://ns.adobe.com/air/application/3.5"
Also note that newer tools can still target older -swf-versions
. So you can build SWFs compatible with older AIR and Flash Players. Just be careful to check the APIs you use in the documentation. Some newer APIs (like BitmapData.drawWithQuality) list a minimum player version requirement under Runtime Versions.
According to this blog post you should check if the namespace line in the HelloWorld-app.xml matches your AIR version.
For example, with the mxml/adl tools that come with the Flex 4.6 distribution, the correct namespace line seems to be
<application xmlns="http://ns.adobe.com/air/application/3.1">
It is also necessary that your mxmlc or amxmlc compiler is not from a newer SDK than the adl.
For example, you can't run AIR apps compiled with Flex 4.6 in adl from AIR 2.6, you need the Flex 4.5 tools for that.
Thank you, your answer helped to solve my issue with IntelliJ Idea and the latest FLEX/AIR package. To solve that error I had to provide a modified application descriptor file for my module, since the automatically generated one had this setting:
<application xmlns="http://ns.adobe.com/air/application/2.0">
Here the steps needed to create a custom application descriptor file:
File - Projext Structure - Modules - AIR Package - Custom template - Create
Pick your minimal AIR version (actually for Flex 4.10 I think it is AIR 3.8) and your module will compile and run without problems.
See screenshot here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With