Latest EAP of IntelliJ IDEA 10.5 supports full cycle of Mobile AIR applications development: write code, compile, package, install, run and debug on emulator or Android device! Let’s look at common development workflow.
- Prepare your computer and Android 2.2+ device for development. Enable USB debugging on the device. Windows users probably need to install a USB driver (included in AIR SDK 2.6) and disable firewall (Vista, Windows 7) or open ports 7 and 7936 (XP).
- Download Flex SDK 4.5 and extract it to any folder on your computer. Alternatively if you already have Flash Builder 4.5 installed you can use SDK included in its installation.
Note: Pre-release versions of Flex SDK 4.5 are not supported. Use Flex SDK 188.8.131.5267.
Basically, all you need to create AIR mobile project in IntelliJ IDEA is to create a module of ‘ActionScript/Flash/Flex’ type that uses SDK of ‘AIR Mobile’ type. Just go through simple steps using File | New Project wizard. When doing it first time you need to click […] button and add AIR Mobile SDK pointing to the Flex SDK 4.5 installation.
As soon as a project is created it is recommended to configure default run configurations for the project. Click Run | Edit Configurations, expand ‘Defaults’ node and select ‘AIR Mobile’ run configuration. For example, if by default you are going to debug applications on Android device over USB you should set options in the same way as on the following screenshot.
In a few seconds the application will start on the device!
If you need to use custom AIR application descriptor file – generate it using Tools | Flex | Generate AIR Application Descriptor action and then update it in a way you need. Create run configuration based on your descriptor file (in opposite to the example above where ‘MobileApp2’ run configuration is based on application main class and descriptor file is generated by on the fly).
To package native Android application as well as iOS application use Tools | Flex | Package Mobile AIR Application.