Jono Kafkaris
Interactive Developer

How I Got Started with Android in FDT on OSX

*******************
BEFORE READING
*******************
This post is rather raw – no extended details – no screenshots – and long-ish.

I hope to clean it up and and add screenshots or create a new post if I find a better way to do it, but until then I just did not want to leave it sitting in my drafts in case it may assist someone.

Now you’ve read that, you can proceed!
******************

******************
EDIT 09/07/2011: Since the release of FDT 4.5 much of this you don’t have to do!
I’m pretty sure this way will still work but, adding things like Android’s Eclipse debugging tools can be handy and creating virtual devices and testing on them would be handy too if you don’t have an Android device.
******************

This is a post on how I have my set-up to develop with Android and Adobe AIR.

It involved visited many sites, reading blogs, watching videos and banging my head on the table.

But I got there – this may not be the most efficient way to do this so always open for suggestions on how to make it easier or better.

I will try to reference all sites and info I used – this post is more for me to remember how I set things up but if it helps anyone else, that’s a bonus.

This is for setting up on OSX 10.6.4

Get Android SDK:

http://developer.android.com/sdk/index.html

Download and unzip. Run “android” from the “tools” folder.

Click on “Available Packages” fold down “Android Repository”

Check:
Android SDK Tools
Android SDK Platform-tools
Documentation for Android
SDK Platform Android 2.3
SDK Platform Android 2.2

Click “Install Selected” – will install the above, give a few minutes.

Click “Virtual devices”, click new, give it a name, select a target, click “Create AVD”. We can now develop on an Android emulator.

Click “Start…” and then “Launch” to get it running.

First time you will need to install the AIR runtime on the emulator.

Open “Terminal”, navigate to the “platform tools” folder.

type and run:
./adb install //flex_sdk_4.5.0.18623/runtimes/air/android/emulator/Runtime.apk

If you would like Android’s Eclipse debugging tools available, in FDT got to Help > Install New Software…

In the “Work with” field enter “https://dl-ssl.google.com/android/eclipse/”

This will find “Developer Tools”. Follow installation steps.

Once installed restart FDT, you may get a message about the Android SDK is missing, if so, go to, FDT > Perferences > Android and in the “SDK Location” field browse to the Android SDK you downloaded earlier.

navigate to Window > Show View > Other

Under Android all “Devices” and “LogCat”

If you have your emulator running you will see it in the “Devices” tab.

If you select the device or emulator you will be installing your app to, your trace() statements will be seen in LogCat.

If you have an Android device, go to the Android Market and search for “Adobe AIR”. Should be first listed, install it.

Get either AIR 2.5 SDK

http://www.adobe.com/products/air/sdk/

and merge with your existing Flex 4.1 SDK

To merge, copy AdobeAIRSDK.tbz2 to your Flex SDK root folder and in terminal use “tar jxvf AdobeAIRSDK.tbz2″

or get Flex Hero

http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+Hero

Add the chosen SDKs to FDT

Install Open Screen Project Manager. This is an great project that Romain Ecarnot has released. Not only can you develop for Android but also other mobile devices.

http://blog.customactions.net/2010/12/openscreen-project-manager-released/

Follow Romain Ecarnot instructions.

The version on the site is slightly different to the one shown in the video and also the Android SDK folder structure had change too.

In the ANT file for Android “build > device > android > build.xml” all references to the “adb” file are currently pointing at the “tools” folder in the Android SDK. This has changed. It is now located in the “platform-tools” folder. Find and change all occurrences of this.

In the build folder run “project.osp”

click on Platform – point to Android SDK and save.
click on Device – select a profile from “Android profile” and save
click on Project and fill out empty fields and add any other setting that are available and save.

If you Ant tab is not visible got Window > Show View > Ant

From the build folder drag “build.xml” to the Ant tab. spin the drop down and you should see a number of option.

The Ant file will only work if it is set to the same JRE as the workspace. To do this got to “External Tool Configurations…” under the drop-down of the icon with the toolbox. With your Ant Build selected, click on the JRE tab and in the option under “Runtime JRE”, “Run in the same JRE as the workspace”. Apply and Close.

Write some code to the location as you setup in “project.osp”

If your Emulator is not open, in the Ant tab, double click Android 01 and start the Emulator

If you have an Android device, switch it to Developer mode and attach the USB.

If this worked correctly you should now see 2 devices in the “Devices” tab.

Double Click “Android 02″ – and you should see your app in running in the external adl player.

Double Click “Android 03″ – and it should install and run on the Emulator.

Double Click “Android 04″ – and it should install and run on the connected device.

This post is featured on FDT’s Community Resources – check out this page for HEAPS more great info! – http://fdt.powerflasher.com/docs/Community_Resources

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

css.php