The Android emulator is slow – really slow. Thanks to Intel we can speed it up with the x86 Emulator Accelerator (HAXM), but as you can tell by reading the Appcelerator blog or even Alberto’s shorter version it’s not that easy to set-up. What we really need is Genymotion – the fast en easy to use Android emulator running on Oracle’s VirtualBox!
For those who can’t wait
But if you can’t wait – like me – here’s a walk through on how to use Titanium 3.2 with Genymotion today. Don’t worry, you can always roll back to the current stable CLI and SDK. You’ll find for that instructions later on.
- Download and install Oracle’s VirtualBox.
- Open and close VirtualBox or Genymotion might not recognize it later.
Setting up Genymotion
- Sign up with Genymotion and download the emulator.
- Install Genymotion (and Genymotion Shell).
- Follow the Quick Start to download your first virtual device. Yes.. it’s just Android 4.x and up you can choose from.
- To connect to ADB, go to Settings and browse to your root Android SDK folder.
- Select a virtual device and press Play.
- Enjoy Genymotion’s speed while doing the initial device setup.
Upgrading to Titanium 3.2
- Open a terminal window.
- Upgrade the Titanium CLI to the current master on GitHub:
sudo npm install -g git://github.com/appcelerator/titanium.git
- Download and install the current master of the Titanium SDK:
ti sdk install -b master --default
- Write down the exact SDK version installed or look it up:
ti sdk list
Building to Genymotion
- Make sure you have a virtual device running.
- Make sure the app’s tiapp.xml is targeting the 3.2.0.x version you installed:
- Build to device:
ti build -p android -T device
- The app should build and launch in Genymotion.
Building for iOS with 3.2
Of course you can also use the 3.2 CLI to build for iOS. If the project you build does not use the 3.2 master SDK, you will probably run into an error because the CLI picks the wrong iOS SDK version. You can fix this by explicitly setting it, e.g.:
ti build -p ios -I 7.0
To roll back to the current stable versions just do:
sudo npm rm -g titanium
sudo npm install -g titanium
ti sdk uninstall 3.2.0.v[YOURNIGHTLYHERE]
Genymotion for Titanium 3.1
If you’ve connected Genymotion to ADB, you can also use it with Titanium 3.1 (or older) by first doing a build only and then install it over ADB.
ti build -p android -b
adb install -r build/android/bin/app.apk
Thanks to Reymundo for pointing this out.