Quantcast
Channel: Skypanther® Studios
Viewing all articles
Browse latest Browse all 25

Easy Genymotion builds with Ti 3.2 RC

$
0
0

Update: An hour or so after I posted this, Appcelerator posted an entry on their Developer’s Blog describing how to use Genymotion with the 3.2 CLI. I encourage you to check out that official solution. — Tim

I’ve started using the blazing-fast Genymotion emulator for my Android development. Unfortunately, the Titanium/Appcelerator tooling doesn’t support directly installing builds to your Genymotion emulator. That will come with a future version of the tooling. Till then, you have to resort to some command-line operations.

Perhaps you read Fokke Zandbergen’s article about using the Genymotion emulator. In it, he states you can use the following commands to build your (Alloy) project then install it to your running Genymotion emulator:

ti build -p android -b
adb install -r build/android/bin/app.apk

I used these commands so often, I created an alias, which worked great. By adding the following to my .bash_profile file, all I had to do was type genny (in my app’s directory) to build and install the app.

alias genny="ti build -p android -b && adb install -r build/android/bin/app.apk"

The problem is that the RC builds (and presumably the final build) of Titanium 3.2 no longer builds a file called app.apk. It now names that file after your app’s name. That breaks my alias. Fortunately, bash supports functions. Here’s how I updated my .bash_profile file:

function __gInstall {
   adb install -r build/android/bin/${PWD##*/}.apk;
}
alias genny="ti build -p android -b && __gInstall"

The ${PWD##*/} within that function will be replaced by the name of your current directory, which is typically matches your app’s name. Now, I can again simply type genny and it will build and install my app!

To wrap this all into a set of steps you can follow, enter these commands at your OS X terminal:

cd ~
touch .bash_profile
open .bash_profile

Paste in the function and alias statement above, save your changes, then open a new terminal window. You should be all set.

(Credit to http://stackoverflow.com/a/4060984 for the bash function solution.)


Viewing all articles
Browse latest Browse all 25

Trending Articles