by

Using Genymotion’s Android emulator with Titanium

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!

Titanium 3.2

Fortunately.. it’s one of the awesome things that the complete rewrite of the android build process will bring to Titanium 3.2. This release is currently scheduled for November 15th.

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.

Installing VirtualBox

  1. Download and install Oracle’s VirtualBox.
  2. Open and close VirtualBox or Genymotion might not recognize it later.

Setting up Genymotion

  1. Sign up with Genymotion and download the emulator.
  2. Install Genymotion (and Genymotion Shell).
  3. Follow the Quick Start to download your first virtual device. Yes.. it’s just Android 4.x and up you can choose from.
  4. To connect to ADB, go to Settings and browse to your root Android SDK folder.
  5. Select a virtual device and press Play.
  6. Enjoy Genymotion’s speed while doing the initial device setup.

Upgrading to Titanium 3.2

  1. Open a terminal window.
  2. Upgrade the Titanium CLI to the current master on GitHub:
    sudo npm install -g git://github.com/appcelerator/titanium.git
  3. Download and install the current master of the Titanium SDK:
    ti sdk install -b master --default
  4. Write down the exact SDK version installed or look it up:
    ti sdk list

Building to Genymotion

  1. Make sure you have a virtual device running.
  2. Make sure the app’s tiapp.xml is targeting the 3.2.0.x version you installed:
    <sdk-version>3.2.0.v[YOURNIGHTLYHERE]</sdk-version>
  3. Build to device: ti build -p android -T device
  4. 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.:

Rolling back

To roll back to the current stable versions just do:

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.

Thanks to Reymundo for pointing this out.