VN:F [1.9.10_1130]
Rating: 0.0/10 (0 votes cast)

Following on from my last post about getting up and running with Flex. Here is how to quickly get an end to end Android dev environment up and running with Flash Develop.

You can download the complete Flash Develop project from here. But you will need to update the SDK paths.

Step 1 : Install Flash develop and the latest Android and Flex 4.5 SDKs

Install Android SDK

Download Abobe flex 4.5

Download and install Flash Develop

Step 2 : Create a new Flash Develop Project

Create a new Air Flex 4 Projector project and give it a name e.g. “MyFlexProject”

Create a new flash develop project

Step 3 : Enable the project for Flex 4.5 compilation

In FlashDevelop go to Project -> Properties and under the “Output” tab you will need to create a custom command to test your movie as follows : $(FlexSDK)\bin\adl.exe;application.xml bin. Replace $(FlexSDK) with the path to the flex 4.5 SDK that you downloaded.

Set the platform target

Under the “Compiler options” tab set the “Custom path to flex sdk” property to your flex SDK bin directory that you downloaded earlier.

Add the following additional command line arguments:

Set the compiler options

Step 4 : Create the application.xml file

Now we need to replace the application.xml with the latest supported version from the SDK. I always start with the Applicaiton.xml content that comes with the SDK to pick up any changes. In your flex 4.5 SDK directory under “Templates\Air” copy the contents of the descriptor-template.xml and paste into your application.xml file.

Step 5 : Setup the package and deployment .xml files

Open the PackageApplication.xml and change the adt call to :

call adt -package -target apk-emulator %SIGNING_OPTIONS% %AIR_FILE% %APP_XML% %FILE_OR_DIR%

Change the signing options by removing the TSA option:

set SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERTIFICATE%

Change the AIR_FILE variable to point to an apk file instead of a .air file e.g.

set AIR_FILE=air/YourProjectName.apk

You will also need to update all the references to “$(FlexSDK)” to the path of your flex SDK. The same will need to be done for the CreateCertificate.bat file.

Step 6 : Create an android deployment bat file

Just to make things a little easier, create a deployment bat file with a call to…

call adb install -r air\MyFlexProject.apk

Create a deployment bat file

Step 7 : Test your project

Build the project to test the new settings. If everything has been setup correctly your project should build successfully.

Step 8 : package for android

Now let’s package the application for installation on an Android device.

Run your CreateCertificate.bat file and then run the PackageApplication.bat file. For the package to work you will need to ensure you have valid values set in the applicaiton.xml file. If all goes well you should find a .apk file in the air sub directory of your project working folder.

Step 9 : Deploy to the android emulator

Run the Android SDK and AVD Manager which you will find in your start menu once you have installed the Android SDK.

Android AVD manager

Create an Android Device which must be running Android 2.2 and above to be able to run the Flex 4.5 Air runtime. Start up the Device.

Android device

Step 10 : Test your application on the device

Just to make sure the environment is running smoothly; go back to Flash develop and open the main.mxml file and add a panel with a simple label control. You will need to change the Root “WindowedApplication” tag to a “Application” tag. WindowedApplication is not supported by Android.

Create a simple panel

Now Build the project and run it. You should See your Panel and Label in the Air debug launcher.

Debug your application

Now Install your application onto the device using the PackageApplciation.bat file and then run the DeployToAndroid.bat file that you created earlier.

Deploy your application

You should now see your application appear in the Apps on the emulator

Your application should now be installed

After running the application it should look as it did when you ran it in debug mode.

The running application


VN:F [1.9.10_1130]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.10_1130]
Rating: 0 (from 0 votes)

No Comment.

Add Your Comment