How to Not Use Titanium Studio
note: this tutorial describes how to use the original Python build scripts that studio uses. There is a new cli interface for Titanium. Check it out if you’re interested in developing on the command line.
This is a tutorial for those who are frightened by the bloat of Titanium Studio
and would rather use the python scripts directly. It would help if you use my
tool, tsm, to manage your Titanium SDK versions;
however, if you’d rather not, replace the bottom references to
tsm run 2.0.1with/path/to/mobilesdk/os/2.0.1/titanium.pytsm builder.py 2.0.1 iphonewith/path/to/mobilesdk/os/2.0.1/iphone/builder.pytsm builder.py 2.0.1 androidwith/path/to/mobilesdk/os/2.0.1/android/builder.py
You can install tsm like this:
$ npm i -g tsmIf you’re using tsm – awesome! Grab the latest stable sdk with
$ tsm install 2.0.1and you’re ready to rock. Most of what you’ll need to do can be accomplished
with the titanium.py script, which you can run with the tsm run command.
However, we’ll have to use the builder.py script directly for some things
which are either not possible or broken with the titanium.py script. Here’s
the basics:
iPhone Simulator
$ tsm run 2.0.1 run --platform=iphoneiPad Simulator
This one uses the builder.py script. You’ll have to replace $IOS_VER with the version of simulator to use (such as 4.0), $IOS_ID with your app id, and $APP_NAME with the name of the app.
$ tsm builder 2.0.1 iphone run "`pwd`" $IOS_VER $IOS_ID $APP_NAME ipadSo for example:
$ tsm builder 2.0.1 iphone run "`pwd`" 5.1 com.test.app TestApp ipadiOS Distribution
For distribution, we need the builder.py script.
$ tsm builder 2.0.1 iphone distribute $IOS_VER "`pwd`" $IOS_ID $APP_NAME $MOBILEPROVISION $DEVIDENT "`pwd`/build/iphone/" universalThis will create an $APP_NAME.app which you can codesign with /usr/bin/xcrun;
I described this in a previous post.
Android Emulator
To start the Android emulator, we need the Android builder.py script
$ tsm builder 2.0.1 android emulator $APP_NAME $ANDROID_SDK "`pwd`" $ANDROID_ID "6" $ANDROID_SKIN“6” is the AVD ID, which identifies this Android device. You’ll see it in the
android program which comes with the Android sdk and lists AVDs.
$ANDROID_SDK is the path to your sdk.
$ANDROID_SKIN is one of the valid skins listed in the android program:

Android FastDev Launching
Before trying to launch you should put
ANDROID_SDK=/path/to/androidsdk/into your .bashrc.
First, you’ll need to launch the emulator.
Then,
you can use the titanium.py script to start the fastdev server:
$ tsm run 2.0.1 fastdev startNow that you’ve started the server, you can launch the app:
$ tsm run 2.0.1 run --platform=androidCleaning the project
To clean the project you can just touch the tiapp.xml:
$ touch tiapp.xmlConclusion
Unfortunately the titanium.py script can’t launch the emulator or build iOS
distributables. But, in combination with the builder.py scripts
you can pretty much completely ignore Titanium Studio.
I recommend using some kindof Makefile (or Cakefile, Jakefile, Rakefile, etc) to manage all of these commands.
Hope this helps.
blog comments powered by Disqus