您的位置:首页 > 移动开发 > Android开发

[AIR Android] Flex开发Android应用,用命令行打包APK

2013-11-04 22:49 597 查看
http://bbs.9ria.com/thread-65775-1-2.html

论坛上有好多朋友要我发一个用Flex开发Android的教程,下面为大家讲解一下。

本人不喜欢写很多字,我认为图片简洁明了,按着图片做下去,就不会有问题。如果有问题,大家跟帖提问,共同讨论。

好了,下面开始进入正题!



首先,我们需要air for android的sdk,就是这个:



----------------------------------------------------------------

然后在FB的目录下,找到SDKS文件夹,进入文件夹把4.0.0复制一份出来,然后重新命名(名字可以随便叫,自己能找到就好),这里我命名为Android



然后把那个压缩包解压覆盖到Android这个文件夹下。

然后在FB里新建FLEX项目,详情见图:



在这里配置SDK,把刚才那个SDK添加进来。



选择刚才添加的SDK进行下一步:



到这里要注意!



需要命名为.as,就是红色框里面的东西。

下面进入重要的环节,创建证书,也就是钥匙。



我们来分析一下XML里面的东西

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

<application xmlns="http://ns.adobe.com/air/application/2.5">

<id>AndroidAPP</id>

<!-- 版本号 -->

<versionNumber>0.1.14</versionNumber>

<versionLabel>0.1.14</versionLabel>

<!-- 输出的文件名 -->

<filename>AndroidAPP</filename>

<description/>

<!-- To localize the description, use the following format for the description element.<description><text xml:lang="en">English App description goes here</text><text xml:lang="fr">French App description goes here</text><text xml:lang="ja">Japanese App
description goes here</text></description>-->

<!-- 此应用在手机上的名字 -->

<name>AndroidAPP</name>

<!-- To localize the name, use the following format for the name element.<name><text xml:lang="en">English App name goes here</text><text xml:lang="fr">French App name goes here</text><text xml:lang="ja">Japanese App name goes here</text></name>-->

<copyright/>

<initialWindow>

<!-- 下面这些都是对应的中文意思 -->

<content>AndroidYYBeta.swf</content>

<systemChrome>standard</systemChrome>

<transparent>false</transparent>

<visible>true</visible>

<!-- 全屏 -->

<fullScreen>true</fullScreen>

<renderMode>auto</renderMode>

<!-- 自动检测(重力感应适应屏幕) -->

<autoOrients>false</autoOrients>

<!-- 方向 -->

<aspectRatio>landscape</aspectRatio></initialWindow>

<icon>

<!-- 图标 -->

<image48x48>icon48.png</image48x48></icon>

<customUpdateUI>false</customUpdateUI>

<allowBrowserInvocation>false</allowBrowserInvocation>

<android>

<manifestAdditions>

<![CDATA[<manifest>

<uses-permission android:name="android.permission.INTERNET"/>

</manifest>]]>

</manifestAdditions>

</android>

</application>

复制代码
然后进行打包apk



adt -package -target apk-emulator -storetype pkcs12 -keystore android.p12 Test.apk Test-app.xml Test.swf

复制代码
For physical device:

adt.bat -package -target apk -storetype pkcs12...

For emulator:

adt.bat -package -target apk-emulator -storetype pkcs12...



OK,这样,我们的APK就打包成功了!

新版的FB已经有了Android的SDK

更新了2.3的模拟器,tools里没有adb.exe,详情请浏览

http://bbs.9ria.com/viewthread.p ... mp;extra=#pid558083

感谢76楼的兄弟【causlayer】提供 linux系统的配置方法:

如果是在linux下配置,需要配置环境变量,以root身份打开/etc/environment,在后面添加FLEXSDK和android下tools的路径,例如:/home/causlayer/workspace/Flex sdks/Android/bin:/opt/android-sdk-linux_x86/tools.请安装最新的airsdk,Runtime_Emulator_Froyo_20100930.apk到模拟器。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: