Starting with Titanium and Android

titanium-appcellerator-androidAppcelerator Titanium is one of the 3 cross-platform mobile frameworks (the other 2 are Rhodes and PhoneGap). Similar to PhoneGap, it exposes devices capabilites through Javascript and you write your app using HTML, CSS and of course, Javascript. What really sets Titanium apart is its user interface API: you can use Javascript to create table views or other specific user interface controls. This leads to the best replication of the native look & feel.

Android SDK installation

* Download Android SDK from: http://developer.android.com/sdk/index.html
* Decompress the archive to ~/Library for example
* Run ~/Library/android-sdk-mac_86/tools/android
* Go to Settings, check “Force https://…” sources to be fetched using http://…” and click Save & Apply

android_settings

* Go to Available Packages, expand the default URL, select all and click Install Selected (it will take a while to download all SDK versions and you can find them in ~/Library/android-sdk-mac_86/platforms/)

android_packages

You have now all versions of Android SDK installed on your machine.

Titanium installation

Download Titanium Developer from http://www.appcelerator.com/products/download/. This software allows you to create projects and build for simulator or device.

Creating a project

  1. Click New Project in Titanium
  2. Fill Mobile for Project type (after this selection iPhone SDK and Android SDK at the bottom)
  3. Click Android SDK and select the folder where you have the Android SDK (~/Library/android-sdk-mac_86_2/); a green check mark should appear after a few moments. titanium_create_project
  4. Fill in the rest of the fields and click Create Project (a very basic app will be generated for you).
  5. Now you should be able to select your project in the left panel (under Projects). In your project view, click Test & Package and then Run Android Emulator
  6. It will take a few moments for Titanium to analyze what Android SDK versions you have on your machine. When it’s ready, you can select a version and click Launch titanium_launch

Android simulator takes longer to load than iPhone simulator, so be patient. If you want to see some sample projects you can download them from Titanium Mobile Dev Center: http://www.codestrong.com/timobile/samples/.