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/.
- Install the Android SDK and download Android 2.2 (with the Google APIs).
- Install scons: http://www.scons.org/.
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
- 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/)
- The new SDK should be available to select from within Titanium Studio to build your project.
Linux
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
- Download the Android SDK and NDK. Expand each to the user's home directory or some other convenient location.
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
- Launch the Android manager and download the Android 2.2 APIs, including the Google APIs.
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
- Unpack newly-generated SDK zip from titanium_mobile/dist/mobilesdk-x.x.x-linux.zip to your Titanium Mobile SDK directory.
The new SDK should be available to select from within Titanium Studio to build your project.