這篇教學是因為我沒有CS5.5可是我又想測試Android,所以自己摸索了一下找出方法~XD
因為Adobe在包裝APK檔不會去確認swf檔的版本,所以可以通通打包起來!!!
首先你必須有以下2個SDK
1.AIR2.6+以上的SDK,請到Adobe下載
2.Andorid SDK
開始重點來了
1.請先把AIR的libs設定到系統環境變數內,這樣可以直接使用bat批次檔操作,省時省力!
2.請用CS5 建立p12金鑰擋
3.bat檔內容:
adt -package -target apk-emulator -storetype pkcs12 -keystore configPK/androidPK.p12 Test.apk Test-app.xml apk/
bat檔說明:
1.adt 為adobe開發的打包工具
2.-package 打包為安裝檔
3.-target 打包為哪種格式,有apk,apk-debug,apk-emulator
4.-storetype pkcs12 金鑰格式
5.-keystore configPK/androidPK.p12 金鑰檔名位置
6.Test.apk 打包出來後的檔名,因為我們是要做成android的,所以副檔名為apk
7.Test-app.xml AIR設定檔
8.apk/ 除了AIR設定檔設定要打包的檔案之外還要額外打包的檔案或是目錄
4.安裝APK檔到Android模擬器
adb install -r Test.apk -r為重新安裝
如果不使用-r,而且你的版本編號都一樣,android會視為已安裝過,就忽略安裝
附1.AIR設定檔參考
我有加入中文說明,供大家參考
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="
http://ns.adobe.com/air/application/2.6">
<!-- Adobe AIR Application Descriptor File Template.
Specifies parameters for identifying, installing, and launching AIR applications.
xmlns - The Adobe AIR namespace:
http://ns.adobe.com/air/application/2.6
The last segment of the namespace specifies the version
of the AIR runtime required for this application to run.
minimumPatchLevel - The minimum patch level of the AIR runtime required to run
the application. Optional.
-->
<!-- A universally unique application identifier. Must be unique across all AIR applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<!--程式ID-->
<id>Test</id>
<!-- Used as the filename for the application. Required. -->
<!--程式檔名-->
<filename>Test</filename>
<!-- The name that is displayed in the AIR application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<!--程式名稱-->
<name>Test</name>
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
<!--程式版本編號,如果跟手機上版本編號一樣則不會安裝程式-->
<versionNumber>0.1.3</versionNumber>
<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
<!--程式版本名稱-->
<versionLabel>alpha</versionLabel>
<!-- Description, displayed in the AIR application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<!--程式描述-->
<description>LiarsDice</description>
<!-- Copyright information. Optional -->
<!--程式版權-->
<copyright>SNSPlus</copyright>
<!-- Publisher ID. Used if you're updating an application created prior to 1.5.3 -->
<!-- <publisherID></publisherID> -->
<!-- Settings for the application's initial window. Required. -->
<!--程式初始化設定-->
<initialWindow>
<!-- The main SWF or HTML file of the application. Required. -->
<!-- Note: In Flash Builder, the SWF reference is set automatically. [This value will be overwritten by Flash Builder in the output app.xml]-->
<!--程式預設包裝檔案路徑,後續檔案可使用ADT包裝成APK檔一併匯入-->
<content>apk/main.swf</content>
<!-- The title of the main window. Optional. -->
<!--程式標題-->
<title>程式標題</title>
<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
<!-- <systemChrome></systemChrome> -->
<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
<!--是否設定為透明模式,預設為false-->
<!-- <transparent></transparent> -->
<!-- Whether the window is initially visible. Optional. Default false. -->
<!--程式初始化過程中是否要顯示視窗-->
<!--<visible>true</visible>-->
<!-- Whether the user can minimize the window. Optional. Default true. -->
<!--使用者可不可以最小化程式視窗,預設為true-->
<!-- <minimizable></minimizable> -->
<!-- Whether the user can maximize the window. Optional. Default true. -->
<!--使用者可不可以最大化程式視窗,預設為true-->
<!-- <maximizable></maximizable> -->
<!-- Whether the user can resize the window. Optional. Default true. -->
<!--使用者可不可以改變程式視窗大小,預設為true-->
<!-- <resizable></resizable> -->
<!-- The window's initial width in pixels. Optional. -->
<!--程式視窗寬度-->
<!-- <width></width> -->
<!-- The window's initial height in pixels. Optional. -->
<!--程式視窗高度-->
<!-- <height></height> -->
<!-- The window's initial x position. Optional. -->
<!--程式視窗X座標-->
<!-- <x></x> -->
<!-- The window's initial y position. Optional. -->
<!--程式視窗Y座標-->
<!-- <y></y> -->
<!-- The window's minimum size, specified as a width/height pair in pixels, such as "400 200". Optional. -->
<!--程式視窗最小化後視窗大小 預設為400 200-->
<!-- <minSize></minSize> -->
<!-- The window's initial maximum size, specified as a width/height pair in pixels, such as "1600 1200". Optional. -->
<!--程式視窗最大化後視窗大小 預設為1600 1200-->
<!-- <maxSize></maxSize> -->
<!-- The initial aspect ratio of the app when launched (either "portrait" or "landscape"). Optional. Mobile only. Default is the natural orientation of the device -->
<!--程式是否要因應當手機旋轉做處理,portrait=直立 landscape=橫向,預設為自動旋轉-->
<!--<aspectRatio>portrait</aspectRatio>-->
<!-- Whether the app will begin auto-orienting on launch. Optional. Mobile only. Default false -->
<!--程式是否要因應當手機發生旋轉事件做處理,預設為false-->
<!-- <autoOrients></autoOrients> -->
<!-- Whether the app launches in full screen. Optional. Mobile only. Default false -->
<!--程式是否全螢幕,預設為false-->
<!--<fullScreen>true</fullScreen> -->
<!-- The render mode for the app (either auto, cpu, or gpu). Optional. Mobile only. Default auto -->
<!--程式處理圖像方式,自動,CPU處理,GPU處理,預設為自動-->
<!-- <renderMode></renderMode> -->
<!-- Whether or not to pan when a soft keyboard is raised or lowered (either "pan" or "none"). Optional. Defaults "pan." -->
<!--當出現輸入框時,要使用什麼模式的輸入介面,觸控筆或是預設,預設為觸控筆-->
<!-- <softKeyboardBehavior></softKeyboardBehavior> -->
<!--實際設定-->
<aspectRatio>landscape</aspectRatio>
<autoOrients>false</autoOrients>
<fullScreen>true</fullScreen>
<visible>true</visible>
<softKeyboardBehavior>none</softKeyboardBehavior>
</initialWindow>
<!-- We recommend omitting the supportedProfiles element, -->
<!-- which in turn permits your application to be deployed to all -->
<!-- devices supported by AIR. If you wish to restrict deployment -->
<!-- (i.e., to only mobile devices) then add this element and list -->
<!-- only the profiles which your application does support. -->
<!-- <supportedProfiles>desktop extendedDesktop mobileDevice extendedMobileDevice</supportedProfiles> -->
<!-- The subpath of the standard default installation location to use. Optional. -->
<!-- <installFolder></installFolder> -->
<!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
<!-- <programMenuFolder></programMenuFolder> -->
<!-- The icon the system uses for the application. For at least one resolution,
specify the path to a PNG file included in the AIR package. Optional. -->
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image36x36></image36x36>
<image48x48></image48x48>
<image72x72></image72x72>
<image114x114></image114x114>
<image128x128></image128x128>
</icon> -->
<!-- Whether the application handles the update when a user double-clicks an update version
of the AIR file (true), or the default AIR application installer handles the update (false).
Optional. Default false. -->
<!-- <customUpdateUI></customUpdateUI> -->
<!-- Whether the application can be launched when the user clicks a link in a web browser.
Optional. Default false. -->
<!-- <allowBrowserInvocation></allowBrowserInvocation> -->
<!-- Listing of file types for which the application can register. Optional. -->
<!-- <fileTypes> -->
<!-- Defines one file type. Optional. -->
<!-- <fileType> -->
<!-- The name that the system displays for the registered file type. Required. -->
<!-- <name></name> -->
<!-- The extension to register. Required. -->
<!-- <extension></extension> -->
<!-- The description of the file type. Optional. -->
<!-- <description></description> -->
<!-- The MIME content type. -->
<!-- <contentType></contentType> -->
<!-- The icon to display for the file type. Optional. -->
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
<!-- </fileType> -->
<!-- </fileTypes> -->
<!-- iOS specific capabilities -->
<!-- <iPhone> -->
<!-- A list of plist key/value pairs to be added to the application Info.plist -->
<!-- <InfoAdditions>
<![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UIRequiresPersistentWiFi</key>
<string>YES</string>
]]>
</InfoAdditions> -->
<!-- <requestedDisplayResolution></requestedDisplayResolution> -->
<!-- </iPhone> -->
<!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->
<!--<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-configuration android:reqFiveWayNav="true"/>
<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> -->
<!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<!--See the Adobe AIR documentation for more information about setting Google Android permissions-->
<!--Removing the permission android.permission.INTERNET will have the side effect
of preventing you from debugging your application on your device-->
<uses-permission android:name="android.permission.INTERNET"/>
<!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
<!--<uses-permission android:name="android.permission.READ_PHONE_STATE"/>-->
<!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>-->
<!--The DISABLE_KEYGUARD and WAKE_LOCK permissions should be toggled together
in order to access AIR's SystemIdleMode APIs-->
<!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
<!--<uses-permission android:name="android.permission.WAKE_LOCK"/>-->
<!--<uses-permission android:name="android.permission.CAMERA"/>-->
<!--<uses-permission android:name="android.permission.RECORD_AUDIO"/>-->
<!--The ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE permissions should be toggled
together in order to use AIR's NetworkInfo APIs-->
<!--<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>-->
<!--<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>-->
</manifest>
]]></manifestAdditions>
</android>
</application>