💤 CLI Toolbelt for Titanium Mobile 2.x development on Mac OS X.
CLI Toolbelt for Titanium Mobile development on Mac OS X.
$ cd /path/to/titanium-workspace/HelloWorld
$ alloy init
create alloy.json
You should place *.coffee
files under the directory named app
.
$ mkdir app
$ echo "Ti.API.console 'Hello'" > app/hello.coffee
Then, run coffee
task.
$ alloy coffee
Compiling CoffeeScript
Successfully compiled CoffeeScript
JavaScript files generated under the Resources
directory.
$ cat Resources/hello.js
// Generated by CoffeeScript 1.3.1
Ti.API.console('Hello');
Run clean
task to clean up intermediate files (build/iphone/*
or build/android/*
).
$ alloy clean iphone
$ alloy clean android
$ alloy build iphone
Before using alloy, you need to create and setup a AVD (Android Virtual Devices) for rapid development process.
Launch Android SDK Manager. Install SDK Platform
and Google APIs
of any Android versions (at least greater than Android 2.2)`
$ ANDROID_SDK_HOME/tools/android &
Check what Android target availables
$ ANDROID_SDK_HOME/tools/android list targets
Available Android targets:
----------
id: 1 or "android-15"
Name: Android 4.0.3
Type: Platform
API level: 15
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
ABIs : armeabi-v7a, x86
----------
id: 2 or "Google Inc.:Google APIs:15"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 2
Description: Android + Google APIs
Based on Android 4.0.3 (API level 15)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA854, WQVGA400, WSVGA, WXGA720, HVGA, WQVGA432, WVGA800 (default), QVGA, WXGA800
ABIs : armeabi-v7a
Create a new AVD
$ ANDROID_SDK_HOME/tools/android create avd \
-n my_android-4.0.3 \
-t 1 \
--abi armeabi-v7a \
--skin WVGA800
my_android-4.0.3
is AVD name, 1
is ID of Android target.
AVD created under ~/.android/avd
.
$ ls -la ~/.android/avd
total 8
drwxr-xr-x 4 juno staff 136 6 1 00:56 .
drwxr-xr-x 6 juno staff 204 6 1 00:51 ..
drwxr-xr-x 4 juno staff 136 6 1 00:56 my_android-4.0.3.avd
-rw-r--r-- 1 juno staff 69 6 1 00:56 my_android-4.0.3.ini
$ ANDROID_SDK_HOME/tools/android list avd
Available Android Virtual Devices:
Name: my_android-4.0.3
Path: /Users/juno/.android/avd/my_android-4.0.3.avd
Target: Android 4.0.3 (API level 15)
ABI: armeabi-v7a
Skin: WVGA800
Yay!
Enable SD Card support to install application
$ echo "sdcard.size=256M" >> ~/.android/avd/my_android-4.0.3.avd/config.ini
Start adb server
$ ANDROID_SDK_HOME/platform-tools/adb start-server
Launch Android emulator
$ ANDROID_SDK_HOME/tools/emulator -avd my_android-4.0.3
After Android launch, emulator instance appears as a device.
$ ANDROID_SDK_HOME/platform-tools/adb devices
List of devices attached
emulator-5554 device
$ alloy build android
Exit Android emulator app
Kill adb server
$ ANDROID_SDK_HOME/platform-tools/adb kill-server
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)