Monday, June 14, 2010

Rhodes + Android + Eclipse + Ubuntu 10.4

In an attempt to start using Rhodes to build an Android app, I'm building my local dev environment, hence the title "Rhodes + Android + Eclipse + Ubuntu 10.4".

Handy pages:
Installing ruby and some essentials

So.. let's start at the beginning, we'll need Ruby, rails and rubygems (which is now in the repros - change the X.X below for the latest version - use tab-complete to the the options).
sudo apt-get install ruby-full build-essential rubygemsX.X
Installing rhodes

Once we have done that, let's get rhodes (version 2.0 is currently in beta)
sudo gem install templater
sudo gem install rake
sudo gem install rails
sudo gem install rhodes --pre
Irritatingly, the apt-get install of rubygems doesn't add the path of the gems that we later installed to the PATH... doh! Have a look where rubgems has been installed to - should be something like "/usr/lib/gems/1.9.1/" although the last directory name will clearly depend on what version you installed above. Open up ~/.bashrc and add (thanks to adamtao):
PATH = "${PATH}":/var/lib/gems/1.9.1/bin
export PATH
You also need to install eclipse and the Android SDK and NDK. I'm not going to list the routine for getting it done since it's explained well elsewhere. Setup for android development including getting all the files from the android development site. Setup an Android AVD (Android virtual device) and test the emulator with a simple hello world script.

Setting up rhodes

Now we need to link our rhodes installation to the SDK and eclipse.
You'll be prompted with questions - my answers are below:
  • JDK path: /usr/lib/jvm/java-6-openjdk/
  • Android SDK path: /opt/androidSDK/
  • Android NDK path: /opt/androidNDK/
  • the remainder of the questions related to Windows and Blackberry: (left blank)
Helpful way to find paths is to either look in your path (echo $PATH) or use "locate" (locate java > java_list) and then look in the java_list file that has just been created.

Create a soft link to the rhodes directory:
sudo ln -s /var/lib/gems/1.9.1/gems/rhodes-2.0.0.beta9/ /var/lib/rhodes
First application

So, for now, I'm going to work via the command line and with gedit to edit files; using tutorial2 as a starting point:
  • rhogen app testapp
  • cd testapp
  • joe build.yml
    I wanted to remove the iphone refs and add in some android ones
sdkversion: 2.0.0
name: testapp
version: 1.0
vendor: rhomobile
build: debug
bbver: 4.6
applog: rholog.txt
version: 2.1
extensions: ["extension-name-here", "second-extension-name"]
  • rake run:android
You'll be asked if you want to setup hardware - type yes and answer the questions.

When you have finished, and want to uninstall the app:
  • rake uninstall:android

More to come as a work through the process

No comments: