Adobe AIR for Android Hello World

社会主义新天地 提交于 2019-12-25 04:24:20

问题


Apologies in advance for asking such stupid questions, but: In Workflow for creating AIR applications for mobile devices, they say to

  1. Create an AIR application descriptor file (using the 2.5, or later, namespace).
  2. Compile the application.
  3. Package the application as an Android package (.apk).

What do they mean by an AIR application descriptor file? Do they mean application.xml?

What do they mean by the 2.5 namespace? I see application xmlns="http://ns.adobe.com/air/application/2.0" in application.xml. How do I get the latest namespace?

What do they mean by Compile the application? I'm using Aptana and there's no compile menu option, so do they mean to use the Export Adobe AIR package button.

What do they mean to Package the application as an Android package? Is that the same Export Adobe AIR package button? I don't see .apk mentioned anywhere in Aptana.


回答1:


Say you have an air app: HelloWorld.

By application descriptor file they mean the HelloWorld-app.xml file, where you configure the behavior and basic display of your application (size, icons, etc.)

By 2.5 namespace they mean, that you must have the current air (2.5 or higher) runtime. The current sdk release is the 2.6, downloadable from here.
I'd suggest you to use the (currently latest) Flex Hero SDK though, which is already bound with the air2.5 runtime, this way you don't need to merge the flex and air SDKs manually.
Then you set up your environment to use this new air sdk, and from that point on, in your application descriptor xml the new version will be generated.

By compiling they mean ... well: compiling. making your code understandable by your machine. At this point mxmlc should be used (not compc). More about it here. An IDE usually does this in the background eg. on every save action, or right before running, so probably you shouldn't bother.
After compiling your code, you'll have the proper swf (either debug-enabled or not) inside your bin or bin-release or bin-debug folder.

By packaging the application into an Android package, they mean that you have to create an .apk file (that's and application package used by android). You can create an apk file using the adt command:

adt -package 
    -target apk 
    -storetype [yourstoretyp] 
    -keystore [yourkeystore] HelloWorld.apk HelloWorld-app.xml HelloWorld.swf 

Note

In your application descriptor the visible flag should be set to true:

<visible>true</visible>

Your androidManifest.xml file must be embedded into your air application descriptor xml. A sample embedded android manifest is:

<application>
    [...]
    <android>
        <manifestAdditions>
            <![CDATA[
                <manifest android:installLocation='auto'>
                    <uses-permission android:name="android.permission.INTERNET" />
                    <supports-screens android:normalScreens="true"/>
                    <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
                    <application android:enabled="true">
                        <activity android:excludeFromRecents="false">
                            <intent-filter>
                                <action android:name="android.intent.action.MAIN" />
                                <category android:name="android.intent.category.LAUNCHER" />
                            </intent-filter>
                        </activity>
                    </application>
                </manifest>
            ]]>
        </manifestAdditions>
    </android>
    [...]
</application>


来源:https://stackoverflow.com/questions/5757165/adobe-air-for-android-hello-world

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!