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

Smartphone app development

At, we have had iPhone apps for a while - and they are great. However, with a growing userbase that is using Android and other platforms, we'd really like to expand our apps and develop our teaching files for Android too.

Given the usual mantra of "okay, I'll give it a go", I'd launched myself head first into Android app development. My coding background is traditional webdesign - HTML, PHP, CSS and a little bit of javascript (which has been increasing lately with the use of Jquery).

So, the Java environment that is Android development is completely new to me. After a late night and a little bit of progress, I was pointed in the direction of Rhodes - a Ruby-based development stack that allows traditional HTML, CSS and javascript for designing your app and a Ruby backend for the MVC part of the app.

It sounds amazing - and what's better is that you can take your Rhodes app and build it as an iPhone app, Android app, windows mobile app... And it builds the Objective C++, Java etc. And, to give the apps a naitive feel, all you need to do is tweak the CSS - amazing.

For development, I could use RhoHub, an online SDK which looks pretty cool. But, if you want to create private apps with more than 3 contributors, you need to pay. So, I'm going to attempt to build a Rhodes development environment locally using the Android SDK and eclipse on Ubuntu 10.4 - with me luck!

Blogger templater

I'd heard about the new blogger templater, but hadn't had a chance to play with it. But, given that I'm just about to post another item to the blog about smartphone app development, I thought I'd have a play. And... I was duly impressed... and after a couple of clicks have a much improved look to the blog.