Android Mobile Development

I am starting to write this post as I wait for a bunch of new packages to download and install from the Android SDK and AVD Manager. I’ll let you know now that so far I’ve really liked working on the Android Development Platform – especially with Air.

The tricky part isn’t writing the application. That part is easy and we know that part. The tricky part is building the .apk package and testing the application on an emulator or other valid device.

So that is what I am going to write about, the tricky parts.

Once you read through these posts you’ll have an up and going Air for Android development environment and an initial application to kick you off.

Starting these posts off I will add a few disclosers:

  1. 1. I am not a fan of command line.
  2. 2. I am not a fan of messing with the paths in my computer.

I am not a fan of command line
I just don’t like memorizing a ton of commands or having to go back and reference a ton of commands and paths. One small path issue and BAM nothing works and you have to read through a ton of mixed code to see where your problem is. Not fun.

I am not a fan of messing with the paths in my computer
Seems like every programming language I get into requires a bunch of path changes and if I move computers now nothing works till I set it up. Not fun. I also fear screwing up my computer.

In case you like setting up paths or want to know how there is a guide provided by Adobe called Developing AIR Apps for Android in the prerelease site. That PDF includes a section Setting the path environment variable. Follow that guide.

Solution
I like using ANT. I can set up all my paths in ANT and ANT works directly into your continuous integration environment. So if I move computers I can just set up my properties I’ll be good to go. Finally the amount of commands to memorize goes WAY down or you can just look into the ANT build file and see the available possible commands.

Expert tip!
You can always view the available targets in an ANT file in the command line by running the following command.

1
ant -buildfile build.xml -projecthelp

Want to know what else is pretty slick? I’ve set up the ANT file for you. I’m thinking of making a nice GUI in AIR to help you out, but for now an ANT file will have to help.

Getting Started
The things you’ll need to get started with Air for Android.

  1. - Download the Android SDK
  2. - Sign up for the Air for Android Prerelease program
  3. - Download Air 2.5 from the prerelease site (if you don’t already have access to the prerelease site, you’ll have to wait for your email after you sign up for it)
  4. - Download the prerelease Runtimes (emulator and device)
  5. - Download the Flex 4 SDK
  6. - Combine the Flex 4 SDK with the Air 2.5 SDK

Creating a Project
AIR for Android currently works best with either a Pure AS3 project (no Flex) in either Flash Builder or Flash Professional. If you are building with Flash Professional, there is an extension that Adobe has provided for you to help speed up the .apk build process. If you go through Flash Builder you’ll have to make this file. Again, with the ANT file I am providing either is a very simple path, so choose the development environment that you prefer.

Setting Up Your ANT File
Once you have your projected set up you will be ready to add in the ANT build information. The ANT file that I will use for the rest of these posts is really easy to set up, just drop it (and base.properties) into your application in the root level.

This ANT file provides you the ability to install the device and emulator runtimes, install your application and test it on a device or runtime, set up a device, run the emulator and even run the Android Management device. Again, yes you can do all these things in the command line… but do you want to?

Then you need to create a build.properties text file. This is the file that you will put your own environment’s paths. So if you share this build file, everyone can have their own properties and the main build.xml is the same and unchanged.

build.properties

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Flex SDK File Location on your computer
FLEX_HOME=/Applications/Adobe\ Flash\ Builder\ 4/sdks/android_flex_sdk_4.1.0.16076

#Android SDK Folder on your computer
ANDROID_SDK=${FLEX_HOME}/android/android-sdk-mac_86

#Emulator zip files on your computer
EMULATOR_RUNTIME_ZIP=${FLEX_HOME}/android/Runtime_Emulator_Froyo_20100705.apk.zip
DEVICE_RUNTIME_ZIP=${FLEX_HOME}/android/Runtime_Device_Froyo_20100705.apk.zip

#App Settings
APP_NAME=AndroidTest

#cert
CERT_NAME=SelfSignedCertificate
CERT_ORG_UNIT=Software Development
CERT_ORG_NAME=YourOrgName
CERT_PASSWORD=YourPassword

You’ll probably notice that I put my Android SDK in the same folder as my Flex SDK. This isn’t necessary, I just thought it’d be nice that all the information for my development environment would be in one location.

In upcoming posts we’ll go through how to use the ANT file and manage your development environment.

Good luck in your Adventures with Android.

Don’t miss this, this is the link for the ant files!

If you previously downloaded this ANT file please redownload it. I’ve added quite a few additions to it that should make your development much easier.

From here checkout how to manage your Android SDK environment, how to create a Flash Builder Android Project, or how to create a Flash Professional Android Project.

  • Share/Bookmark

Comments (9)

[...] This post was mentioned on Twitter by tony murphy and Ultra Red, karannnnnnnnnnn3. karannnnnnnnnnn3 said: Android Mobile Development: I am starting to write this post as I wait for a bunch of new packages to download and… http://bit.ly/aEDTCn [...]

Adobe Flex TutorialJuly 19th, 2010 at 11:28 am

Nice article,
if you ain’t a fan of the command line and would like a proper GUI, have a look at this one (still in beta phase):
http://www.webkitchen.be/package-assistant-pro/

Fabien
http://www.flex-tutorial.fr

Jonathan CamposJuly 19th, 2010 at 11:45 am

@fabien I did see that and really liked it. But ultimately I also wanted to create something that would work in with a continuous integration system. But what Serge did was wonderful. My ANT file goes a bit further for my needs as it can also start up an emulator and install on a successful completion if I so choose.

[...] you are starting with this post I recommend actually starting with a previous post introducing AIR for Android Development. There is a ANT file there that you will want to [...]

[...] you are starting with this post I recommend actually starting with a previous post introducing AIR for Android Development. There is a ANT file there that you will want to [...]

[...] and packaged. This should be the most boring part but I was able to quickly adapt a great ANT file shared from Jonathan Campos in a recent [...]

[...] a multi-screen air application I stumbled on a couple articles by Jonathan Campos about Android Air Development. So I must admit that a lot of the ground work was allready done by both Jonathan and Marvin but [...]

[...] If you are starting with this post I recommend actually starting with a previous post introducing AIR for Android Development. There is a ANT file there that you will want to [...]

[...] If you are starting with this post I recommend actually starting with a previous post introducing AIR for Android Development. There is a ANT file there that you will want to [...]

Leave a comment

Your comment