RhoStudio
RhoStudio is an Eclipse installation that facilitates development of native smartphone applications. It installs all Rho products, such as Rhodes and RhoConnect. It provides an integrated development environment (IDE) for Rhodes and RhoConnect development.
Use RhoStudio to:
- Generate Rhodes application(s).
- Generate Rhodes Model(s) and associated Controllers and View templates.
- Generate RhoConnect applications.
- Generate RhoConnect source adapters.
- Manage build configuration (build.yml and rhobuild.yml) using the RhoStudio/Eclipse UI.
- Build, run, and debug your application in the RhoSimulator.
- Build and run your Rhodes application on iPhone, Android, Windows Mobile, and BlackBerry simulators and devices.
- See the build and application execution logs in the Eclipse output console.
- Installing RhoStudio
- Generating a Rhodes Application
- Generating a Rhodes Model
- Editing Rhodes Views
- Managing Your Build Configuration
- Building and Running Your Application
- Using the Debugger
- Importing a Rhodes Project from a non-RhoStudio Source
- Creating a Device Build in RhoStudio
Installing RhoStudio
Installing on Macintosh
If you’re running Macintosh, download the latest RhoStudio for Macintosh.
When the download finishes, click on the RhoStudioInstaller.dmg file to open it. You will get a window similar to this:

Run the install gems script: run “install gems” to install on your standard ruby, or you can run “install gems on rvm” to install in your Ruby Version Manager. A terminal window will open; wait for the gems install process to complete.
Then drag RhoStudio to the Applications folder.
You also have a sample folder that you can drag to where you wish on your computer. You can import these sample Rhodes and RhoConnect projects into RhoStudio.
Installing on Windows
If you’re running Windows, download the latest RhoStudio for Windows and run the download file to install RhoStudio.
If you are running Windows 64-bit, you need to have 64-bit Eclipse, and then you install RhoStudio as a plugin for Eclipse.
Installing the Java Development Kit
You need to have the Java Development Kit (JDK) installed.
If you are planning to build for Blackberry or Android, make sure you have JDK version 1.6.0_2 or higher installed. The recommended version is 6.0 update 11.
For Macintosh, JDK version 1.6.0_24 for Mac OSX 10.6 is available here. Install it and then run “Java Preferences” utility to change default version.
The Sun JDK for Windows is available here. The 32-bit Windows version of the JDK is required for Blackberry tools.
Then in RhoStudio Preferences, open Rhomobile and check that the path is set to your JDK installation.

Generating a Rhodes Application
**
| You also can use RhoStudio to generate a RhoConnect application and source adapter. You can see an example in the RhoConnect tutorial. |
In RhoStudio, select File->New->Project…
The New Project window opens. Select the Rhodes application wizard and click the Next button.

Enter the name for your Rhodes application in Project name; in this case, “storemanager”. You may specify a specific folder for your destination where your project is stored, by default, the destination is your RhoStudio workspace folder. Then press the Finish button.

After pressing the Finish button, you’ll see the Rhodes app generator script output in the output console (Rhomobile build console).

Generating a Rhodes Model
Rhodes applications support a Model-View-Controller (MVC) pattern. To start our application, we will generate a Model. To generate a Rhodes model and create the associated Controller and View templates, right-click on the application project in the Project Explorer and select New->Rhodes model.

In the Model Information window, enter the name for your model: in this case, Product. Also enter the Model attributes as a string with no spaces and each attribute separated by a comma: in this case, name,brand,price,quantity,sku. (Whitespaces at the field name beginning and end will be trimmed and whitespaces in the middle of the field name will be replaced with an underscore character.)
Click the Finish button to create the model.

After pressing the Finish button, you’ll see the Rhodes model generator script output in the output console (Rhodes build log console).

You should now see a ‘Product’ folder below the ‘app’ folder in your storemanager application. These files constitute the Model, Views and Controller file for the Product Model we just created. The files are organized as follows:
- product.rb –> This is the Model file which contains the Model definition. Since we are using the default PropertyBag definition, we don’t need to modify this file any further.
- product_controller.rb –> This file contains the business logic which relates to our Model.
- *.erb –> The .erb files are the html view template files. We’ll be modifying them in the next section.
Editing Rhodes Views
You may edit the generated ERB files to customize the HTML as you see fit. Typically you will provide links to the model index page from the home screen. In order to accomplish this, a modification needs to be made to the default view for the application, called index.erb. Below is the content for the StoreManager app’s generated top level index.erb file (app/index.erb). Open this file for editing.
<div data-role="page" data-url="<%= Rho::RhoConfig.start_path %>/"> <div data-role="header" data-position="inline"> <h1>Storemanager</h1> <% if SyncEngine::logged_in > 0 %> <a href="<%= url_for :controller => :Settings, :action => :do_sync %>" class="ui-btn-left" data-icon="refresh"> Sync </a> <a href="<%= url_for :controller => :Settings, :action => :logout %>" class="ui-btn-right" data-icon="star"> Logout </a> <% else %> <a href="<%= url_for :controller => :Settings, :action => :login %>" class="ui-btn-right" data-icon="star">Login</a> <% end %> </div> <div data-role="content"> <ul data-role="listview"> <li><a href="#">Add link here...</a></li> </ul> </div> </div>
To provide a link to the Product model’s index page and templates, replace the list item with the title ‘Add link here’ with the following:
<li> <a href="Product"> <span class="title">Products</span> </a> </li>
This change now means that when the index.erb view is displayed (the default view when the app starts), you will see a UI element called “Products” that will take you to the controller for the “Product” Model definition. Because no specific action is provided, the controller will default to displaying the Model’s index page, in this case the Product model’s index page. All further functionality in the app is carried out by the default scaffolding of the generated controller and view files. These generated files provide basic CRUD (Create, Read, Update, Delete) functionality for your Model.
| You can edit the top level app page or any of the other view templates with any HTML you wish. We don’t attempt to teach you HTML or Ruby here, but there are many good external references for both topics. |
Managing Your Build Configuration
The build.yml file for your application manages your Rhodes build time configuration. Double click on ‘build.yml’ item in your project tree to open the build.yml editor. In the editor you’ll see two tabs: Rhobuild setting for the WYSIWIG editor, and build.yml for the text editor.
Rhobuild setting WYSIWIG editor:

build.yml text editor:

You will have default values for your application name, log file (the log file will be located in your application folder after you run your application), and the path to the Rhodes gem. You can use the WYSIWIG editor to change this. For example, you might want to point to a different RHodes gem if you have more than one Rhodes gem installed.
You can add capabilities to your application, such as camera and vibrate, by pressing the Capabilities: Add button, selecting the capabilities from the popup window, and clicking the Ok button.

The selected application capabilities will appear in the Capabilities: text field in the WISIWIG editor.
Building and Running Your Application
To start the build process, create a Run Configuration: select your project in the Project Explorer, and select Run->Run Configurations… from the menu. The Run Configurations window appears.

To create a new build configuration for your application, select Rhodes Application. Then either right-click on Rhodes Application or click the New button. A new configuration appears under Rhodes Application.

Building and Running with RhoSimulator
You can run your project in RhoSimulator, a simulator type available only in RhoStudio. RhoSimulator allows you to build and run your project on the platform of your choice without having to install the SDK for that platform. Instead, RhoSImulator will mimic the platform. RhoSimulator builds and runs your application quickly, making it useful for testing and debugging.
**
| Once you have done your application development and debugging, you will need to install the SDK to create a build for that device. Or you can upload your project to RhoHub, and use RhoHub to create the build for your device. |
To run RhoSimulator for the iPhone platform, select your project from the Project Explorer (in this case, we use the storemanager project created earlier). Then select Run –> Run Configurations from the main menu. The Run Configurations window appears.

In the Run Configurations window, select RhoSimulator for the Simulator type, and select your desired platform type. For example, if you select iPhone, RhoSimulator will mimic an iPhone. The calls to the system will return as though the application was running on an actual iPhone.
Click Run to start the simulator.

In the storemanager example, we can add a couple of products. Click the Products link, then click New, enter the product attributes, and click Create.

Using the Web Inspector
The RhoSimulator also brings up a Webkit Inspector window, allowing you to inspect the web interface for your application.

For example, you can see the web code for the listview. Here is the listview of the products for the storemanger example. You can see the link for the iPhone URL, and you could change the border color and thickness for the iPhone product (changing from 1px to 3px and solid #CCC to #111 would give the iPhone link a thicker, darker border).

Using the Debugger
You can use the RhoStudio debugger to debug the Ruby code in your application.
To run the RhoSimulator debugger for the iPhone platform, select your project from the Project Explorer (in this case, we use the storemanger project created earlier). Then select Run –> Debug Configurations from the main menu. The Debug Configurations window appears.
Click Debug to start the debugger.
You will again get a RhoSimulator showing your device, and the Web Inspector window. And you get a Debug view in your workspace.
To debug your Ruby code in your application, click the RhoStudio tab in your workspace, then open the Ruby file that you wish to debug.

Now click the Debug tab. You will see the Ruby file opened in the debugger.
Setting a Breakpoint
You can perform operations such as setting a breakpoint: double-click in the left margin at the line of code where you want the breakpoint.
For example, in the storemanager code, there is a rendering section in product_controller.rb.
# GET /Product def index @products = Product.find(:all) render :back => '/app' end
You can set a breakpoint on the line render :back => '/app', then you can go to the RhoSimulator and click on Product. The simulator will stop at the point of rendering.

Inspecting the Variables
You can also inspect the variables. When you click “Products” In the debugger simulator, and you have a breakpoint as set earlier in the product_controller.rb on the rendering line, the application will pause just before the rendering of the product listing page. You can then inspect the variables in the variable window. The storemanager example shows that at this point int he app, the local database has been read, showing that a couple of products have been created (an iPhone and an iPhone4S).

Importing a Rhodes Project from a non-RhoStudio Source
You can have a Rhodes project that you wish to import into RhoStudio. For example, you might have created a project using RhoHub and you have a local repository of that project on your computer). Or you might want to import the sample projects that came with the RhoStudio installer. The import process is similar to importing external projects with standard Eclipse.
Select File –> New –> Project…
From the New Project window, select Rhomobile –> Rhoconnect application or Rhomobile –> Rhodes application. THen click the Next button.

From the Rhodes (or Rhoconnect) application generator wizard window, click the “Create application from existing sources” checkbox.
Click the Browse button, then navigate to and select the folder containing your project. The Project name will change to the name of your project folder.

Click the Finish button. Your project will appear in the Project Explorer.
Creating a Device Build in RhoStudio
Once you have developed your application using the RhoSimulator and debugger, you will need to create a device build of your application. To do this with RhoStudio, you can do this by installing SDKs.
To create a device build with RhoStudio, you need to do the following:
- Install the SDK for your application’s platform.
- Set RhoStudio Preferences to that platform’s SDK.
- In Run Configurations, set to that device, then do the device build and run.
**
| You can do the device build with RhoHub if you wish to avoid installing the SDKs on your computer. To do your device build on RhoHub, upload your application into RhoHub, then use RhoHub to create the device build. Instructions for using RhoHub are in the Rhohub tutorial. |
Installing the SDK
On Macintosh computers, once you have installed Xcode, RhoStudio will know the location of the iOS SDK. You do not set any locations.
On other platforms, such as Android, you need to install the SDK, and then set RhoStudio Preferences for that platform’s SDK. For example, on an Android device, you must download and install:
- The Android SDK Package.
- The Android NDK package.
Set RhoStudio SDK Preferences
Once you have the SDK for your platform installed, set RhoStudio Preferences for that SDK. For example, to do Android device builds:
In the Preferences window, open the Rhomobile item and select Android.
Click the Browse button and navigate to the locations where you installed your Android SDK and NDK.

Set Run Configurations to the Device Build and Run
To start the device build process, create a Run Configuration: select your project in the Project Explorer, and select Run->Run Configurations… from the menu. The Run Configurations window appears. Set Run Configurations as follows:
- Set the Platform to Android.
- Set the Simulator type to either device to run on the device, or simulator to run on the simulator provided with the Android SDK.
- If you set the Simulator type to simulator, set the Platform version number and set the AVD name for Android.


Press the Run button to build and run your application. The build output will appear in the Rhodes build output console. The application log will be available in the Rhodes application output console, and will be written into your application folder.
For complete instructions on setting up the SDKs in RhoStudio for each platform, refer to the Build instructions for Rhodes.
Editing the SDK Locations in rhobuild.yml
Use RhoStudio preferences to edit the rhobuild.yml file, which manages the location(s) of the platform SDKs/JDKs that are used to build your Rhodes application. The rhobuild.yml file is located in the Rhodes gem folder (or, if you copied Rhodes from git, in the Rhodes source code folder).
Print this page
View as a PDF