Building the Titanium SDK

 

 

In order to work around shortcomings of the Titanium Mobile SDK, or to add custom features to the API, it's necessary to modify the SDK iPhone and Android source code. This can either be done in the pre-built SDK, or the already-built SDK.

OS X

In order to compile the Titanium SDK, you must have Python, scons, and Android already installed.

The Titanium Mobile SDK is open source under an Apache version 2 license, and is available on Github https://github.com/appcelerator/titanium_mobile. Compiling the SDK from Github source requires Python (w/JSON) and the cross-platform scons build tool: http://www.scons.org/.

 

  1. Install the Android SDK and download Android 2.2 (with the Google APIs).
  2. Install scons: http://www.scons.org/.
  3. Checkout the source (requires git) and build.

    $ git clone git://github.com/Jasig/titanium_mobile
    $ cd titanium_mobile
    $ git checkout --track -b 1_8_X origin/1_8_X
    $ scons
  4. Unpack newly-generated SDK zip from titanium_mobile/dist/mobilesdk-x.x.x-os.zip to your Titanium Mobile SDK directory (on Mac OS, /Library/Application Support/Titanium/mobilesdk/osx/)
  5. The new SDK should be available to select from within Titanium Studio to build your project.

Linux

  1. A number of libraries are required to successfully build the custom SDK.  The commands below represent what was required on top of a vanilla Ubuntu 11.0.4 installation.  Depending on your distribution and what packages you have installed to date, you may be able to skip some commands or may need to supplement with additional libraries.

    $ sudo apt-get install openjdk-6-sdk
    $ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
    $ sudo apt-get install git
    $ sudo apt-get install ia32-libs
    $ sudo apt-get install gperf
    $ sudo apt-get install scons
    $ sudo apt-get install python-setuptools
    $ sudo easy_install pyyaml
  2. Download the Android SDK and NDK.  Expand each to the user's home directory or some other convenient location.  
  3. Titanium assumes a hard-coded location for the Android installation of /opt/android-sdk.  You will need to create a symlink to the actual install location, add both the tools and platform-tools directories to your path, and set the ANDROID_NDK environment variable.  The following commands assume both the SDK and NDK were installed to the user's home directory; please modify to match your actual path.

    $ sudo ln -s /home/username/android-sdk-linux /opt/android-sdk
    $ export PATH=/opt/android-sdk/tools:/opt/android-sdk/platform-tools:$PATH
    $ export ANDROID_NDK=/home/username/android-ndk-r7b
  4. Launch the Android manager and download the Android 2.2 APIs, including the Google APIs.
  5. Clone Jasig's titanium_mobile repository and switch to the 1.8.x branch, then run scons.

    $ git clone git://github.com/Jasig/titanium_mobile
    $ cd titanium_mobile
    $ git checkout --track -b 1_8_X origin/1_8_X
    $ scons
  6. Unpack newly-generated SDK zip from titanium_mobile/dist/mobilesdk-x.x.x-linux.zip to your Titanium Mobile SDK directory.
  7. The new SDK should be available to select from within Titanium Studio to build your project.