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 email@example.com
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 https://jira.appcelerator.org