Appcelerator Blog

The Leading Resource for All Things Mobile

Using Genymotion with Titanium 3.2

1 Flares 1 Flares ×

Using Genymotion with Titanium

Not long ago we published a blog post about Genymotion, a clever new Android emulator implemented on top of VirtualBox. The post explained how to compile your app with Titanium, and then push it APK into Genymotion via a command-line call.

With Titanium 3.2, there is preview support for Genymotion. This means that Titanium should identify your Genymotion virtual devices, and you can use them just like using the traditional Android Emulator.

Getting the tools

The previously published blog post tells you how to install Genymotion, so make sure you do that.

Now, get the 3.2 Beta of the Titanium CLI from npm. We’ll be downloading the Beta version of the CLI. Once 3.2 is officially out you should re-run this command without @3.2.0-beta to get the GA (General Availability) version. You should be always running GA, as it is the currently supported version.

sudo npm install -g titanium@3.2.0-beta

Then you need to download the latest SDK.

 ti sdk install -b 3_2_X --default

At this point you don’t know the version name that was downloaded, so type:

 ti sdk list

This should give you a list of all the Titanium SDKs currently installed on your computer. There’s one marked as [selected]. Copy its name, e.g. 3.2.0.v20131209192649.

Now open up your app’s tiapp.xml, and paste that number under <sdk-version>. This tells your app to compile using that newer SDK.

Building and testing on Genymotion

First we need to make sure Titanium is identifying your Genymotion emulators, and to do that you need to tell Titanium that you’ll be using Genymotion. Type:

ti config genymotion.enabled true
Now you can use the CLI to query for your current Android setup by typing:

 ti info -t android

Note: Typing ti info returns your full Titanium configuration, which you could redirect to a text file by typing ti info > tiinfo.txt, or even get as a JSON string using ti info -o json

This will return all the information the Titanium CLI has about your Android configuration. Pay attention to the last few blocks, where you should see an entry that reads “Genymotion Emulators”. Go to the one you want to test on and copy its name to the clipboard. Now you’re ready to test your app by typing:

 ti build -p android --device-id "Xperia Z - 4.3 - API 18 - 1080x1920"

Xperia Z – 4.3 – API 18 – 1080×1920 is the name of my Genymotion Emulator and it has to be provided in quotation marks. If you leave out the name of your emulator, you’ll get a list of all your emulators, the Android-provided ones, and the new Genymotion ones — cool!

Roll back to latest Titanium

This process installed a beta version of Titanium. If for any reason you wish to rollback to the latest GA , follow this steps:

 sudo npm rm -g titanium
 sudo npm install -g titanium
 ti sdk uninstall nightly version e.g. ti sdk uninstall 3.2.0.v20131209192649

This functionality is currently in a preview stage. Please report any bugs to http://jira.appcelerator.org

1 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 1 Email -- 1 Flares ×

6 Comments

  1. Seth Benjamin

    I am assuming we won’t be able to do this with native module development? I have the HAXM x86 image running, but the Genymotion emulators are much, much faster. If there is a simple way of accomplishing this, that would be great.

  2. It would be awesome if we could just launch this on the new Studio 3.2.0

    • Answering my own question. With new Ti Studio 3.2 this is REALLY easy to accomplish.

      Open console and type `ti config genymotion.enabled true`, then, under Ti Studio, just hit the “refresh devices” button. Make sure you already have your Genymotion device running.

      Now, the new device will appear on the list. Select it and launch.

      This. is. awesome.

      • This is much easier & faster
        Thanks

  3. thoraz

    Why when I try the command ‘ti info -t android’, in the list of emulators there is “Genymotion Emulators: None”?

    • First of all, you should check whether the property “genymotion.enabled true” is set properly by “ti config” command. Pay attention to your typo. You can run into trouble if there is any typo error.

Comments are closed.

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
1 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 1 Email -- 1 Flares ×