Android Apps with Adobe AIR

Post on 08-Apr-2015

764 views 3 download

description

Get started with developing applications for Android phones using Adobe AIR

Transcript of Android Apps with Adobe AIR

Adobe AIR + Android =

Adobe AIR vs. Java

VS

JAVA: PROS

Established platform, widely accepted

Direct access to Android API

Eclipse IDE officially supported and integrates well with Android SDK

Direct debugging and publishing between IDE and Android Virtual Device

JAVA: CONS

Many 3rd-party Java libraries do not work on Android

Inconsistent debugging

Code will not run on iPhone

ADOBE AIR: PROS

Stable platform, well supported

Much of “desktop” functionality can be ported to mobile device

Easy and fast debugging in Flash IDE

Great for rapid development and prototyping

Same code can be compiled and published to iPhone

ADOBE AIR: CONS

Dependent on a third-party provider (Adobe)

Slower than Java

Pain in the ass to push to device or emulator

CONFIGURING ANDROID VIRTUAL DEVICE

Download and unzip Android SDK (http://developer.android.com/sdk/index.html)

Browse to your Android SDK folder and launch Android SDK and AVD Manager: [Android SDK] SDK Manager.exe

Allow SDK Manager to install all updates

Make sure that under “Installed Packages” you have “USB Driver package” installed

Select “Virtual Devices” option and click “New” to create a new Android virtual device

Create new Android virtual device. Make sure to select Android 2.2 – API Level 8 in the “Target” field

In Android SDK and AVD Manager, select the newly created virtual device and click “Start”

Hopefully now you have a running Android emulator

PREPARING YOUR ANDROID DEVICE

Enable USB debugging on your phone: Settings Applications Development Check “USB Debugging” to enable it.

If developing/debugging onan HTC phone, you need to download HTC Synchttp://www.htc.com/us/support/

Connect your Android device to your computer via a USB cable

Launch “Command Prompt” on Windows and browse to [Android SDK]\tools

Run command: adb devices

You should see your device listed below:

Once your device is connected and recognized by your computer, you can use DDMS tool to monitor what is happening on your physical device: [Android SDK] Tools ddms.bat

You can also view the actual device’s screen: (1) Select your device’s name(2) In the menu, go to Device Screen Capture

INSTALLING ADOBE AIR ON PHYSICAL AND VIRTUAL

DEVICES

Download Adobe Air for Android (http://labs.adobe.com/technologies/air2/android/). You would have to sign up to participate in the pre-release program. There are two files to download – AIR Runtime for Device and AIR Runtime for Emulator. To make things easier later on, save these files to [Android SDK]\tools\

Launch “Command Prompt” on Windows and browse to [Android SDK]\tools\

To install on physical device, run command “adb install [downloaded AIR file for device]”. In my case, the full command is adb install Runtime_Device_Froyo_20100930.apk

To install on virtual device, run command “adb install [downloaded AIR file for emulator]”. In my case, the full command is adb install Runtime_Emulator_Froyo_20100930.apk

PUBLISHING, PACKAGING AND INSTALLING YOUR ADOBE AIR

APPLICATION

Download AIR for Android Extension for Flash CS5 (http://labs.adobe.com/technologies/air2/android/). You would have to sign up to participate in the pre-release program.

If you just installed Adobe Flash CS5, restart your computer before installing AIR for Android Extension for Flash CS5.

If you are not using Windows 7, launch Adobe Extension Manager CS5 normally, by going to Start Programs Adobe Extension Manager CS5.

If you are using Windows 7, use Windows Explorer to browse to Adobe Extension Manager installation folder. On my computer, it is C:\Program Files\Adobe\Adobe Extension Manager CS5/. Right-click on Adobe Extension Manager CS5.exe and select “Run as Administrator”. If you skip this step, AIR for Android Extension for Flash CS5 installation will fail.

In Adobe Extension Manager CS5, click “Install” and browse to the location where you saved the downloaded copy of AIR for Android Extension for Flash CS5. When extension installs, you should see it listed under Flash CS5

Launch Flash CS5 and load your AIR application (.fla file).

Go to File Publish Settings…

Go to “Flash” tab

Under “Player:”, select “AIR Andoid” option.

Click “Settings…” button

Complete information under the “General” tab

Switch to “Deployment” tab

If you do not have a certificate, you can create one (click “Create” button next to “Certificate:” field).

Make sure to select relevant deployment type (Device, Emulator, Debug)

Switch to “Permissions” tab. Make sure to specify correct permissions for your Android AIR application.

Publish your application

Note the location of the .apk file created by the publishing process

Make sure that your Android emulator is running

Launch “Command Prompt” on Windows and browse to [Android SDK]\tools\

To install on physical device, run command “adb install [name of .apk published file from Flash CS5]”. In my case, the full command is adb install LearningLog.apk

CONGRATULATIONS! IF YOU DID EVERYTHING

CORRECTLY, YOUR ADOBE AIR APPLICATION IS NOW RUNNING

ON YOUR ANDROID VIRTUAL DEVICE

Additional Resources & LInks

Adobe AIR releases: http://labs.adobe.com/technologies/air2/android/

Lee Brimelow’s video tutorial on getting started with AIR for Android: http://gotoandlearn.com/play.php?id=123

Getting started with Adobe Air for Android: http://www.adobe.com/newsletters/edge/august2010/articles/article1/index.html?trackingid=HRTDI

Installing Adobe AIR runtime on Android 2.1 emulator: http://www.inter-fuser.com/2010/05/installing-adobe-air-runtime-on-android.html

Dmitriy Babichenko

dbabichenko@yahoo.com

http://www.evillens.com

http://www.wideopenlens.com