Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

Using RhoSimulator

RhoSimulator allows to run Rhodes applications without lengthy build process and to debug them in RhoStudio. Currently RhoSimulator works on Windows only.

Install RhoSimulator

If you have the Rhodes gem, then RhoSimulator is installed already.

If you would like to run RhoSimulator without Rhodes gem, download Windows or Mac OS X version, extract it and specify path to rhosimulator.exe or RhoSimulator.app respectively at rhodes/rhobuild.yml:

env: 
  paths:    
    rhosimulator: <RhoSimulator folder>

Alternatively you may build your own customized version of RhoSimulator as described below.

Run application in RhoSimulator

To run application in RhoSimulator just run in rhodes or application folder:

#run RhoSimulator to simulate specific platform:
rake run:android:rhosimulator 
rake run:iphone:rhosimulator

#bbver from build.yml will be used as System.get_property('os_version')
rake run:bb:rhosimulator

rake run:wm:rhosimulator
rake run:wp:rhosimulator

#run RhoSimulator to simulate 'WINDOWS_DESKTOP' platform:
rake run:win32:rhosimulator

If you modified Rhodes application sources, just press ‘Refresh’ in RhoSimulator to reload application, i.e. generally no RhoSimulator restart is required. The restart of RhoSimulator is required only if a model was added/modified or some code was added to the AppApplication class.

Debugging with RhoStudio

Prerequisites

Starting debug session in RhoStudio

  • Select Run » Debug Configurations… from top menu
  • Find ‘Rhodes Application’ section on the left and add new (or modify existing) configuration
  • On ‘Common setting’ tab select a project by clicking ‘Browse…’ button next to ‘Project name:’
  • Select ‘Rho simulator’ as the platform
  • Click ‘Apply’ and then ‘Debug’

Debug capabilities

In present version of RhoStudio you may:

  • Set breakpoints in Ruby code (.rb files)
  • Watch variable values (global, local, class and instance) – currently auto-watch list is displayed in Expressions window
  • View application log in Console window

Build RhoSimulator

If you use custom native extensions, then running and debugging your applications in RhoSimulator requires a custom build. Follow these instructions to build your own customized version of RhoSimulator.

Preliminary steps for Windows

  • Currently only Visual Studio 2008 is supported
  • Follow Build for Windows – Prerequisites
  • Clean temporary and generated files by running the rake command in the rhodes source folder:

    rake clean:win32
    

Preliminary steps for Mac OS X

  • Follow Building a Rhodes Application for iPhone/iPad – Prerequisites, but do not install the Rhodes gem since you’re going to use Rhodes SDK source.
  • Get the rhodes source (if haven’t done it already) as described here. Don’t forget to add the bin folder to your path, run rhodes-setup and update Rhodes SDK path in build.yml at your application root folder.
  • If you’re using Xcode 4.4 or later, then you must install the OS 10.6 SDK as follows:

    1. Download a version of Xcode for OS 10.7 Lion (such as Xcode 4.3.3.)
    2. Mount the disk image file by double-clicking on it (do not drag-install this older version of Xcode!)
    3. On the disk image, control-click on the Xcode icon and select Show Package Contents.
    4. Browse to the directory Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs. You should see a folder named MacOSX10.6.sdk
    5. Control-click on your newer Xcode icon (which you previously installed on your hard drive) and select Show Package Contents.
    6. In your newer Xcode Browse to the directory Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs.
    7. Copy the MacOSX10.6.sdk folder from the SDKs folder on the older disk image to the SDKs folder in the newer Xcode.
    8. Unmount the disk image by dragging it to the trash.
  • First build the Qt libraries for Mac from sources to enable HTTPS protocol support in RhoSimulator:

    • Download the Qt source:
    • Make sure that your PATH environment variable does not contain the path to any previously installed Qt binaries
    • Add to your ~/.bash_profile the new environment variable QTDIR by adding the line (or by changing the existing QTDIR variable):

      export QTDIR=/Developer/SDKs/Qt
      
    • Restart terminal windows to enable new environment setting.

    • Patch Qt sources by replacing all occurrences of ‘/Developer/SDKs/MacOSX10’ to ‘.*MacOSX10’ in two project files:
      • ~/qt-4.8.2/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro
      • ~/qt-4.8.2/src/plugins/bearer/corewlan/corewlan.pro
    • Open Terminal.app and issue commands:

      $ cd ~/qt-4.8.2
      $ ./configure -opensource -platform macx-g++
        -nomake examples -nomake demos -nomake docs
        -qt-libpng -qt-libjpeg -qt-libtiff -qt-libmng
        -no-qt3support -webkit -release
        -prefix /Developer/SDKs/Qt
        -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
      $ make
      $ sudo make install
      

      If you’re using Xcode 4.2 or earlier, then change the last line of ./configure command to:

        -sdk /Developer/SDKs/MacOSX10.6.sdk
      

      Be aware that it will take a while to build the Qt libraries from sources (maybe few hours or so).

Enable bundled native extensions

To enable digest native extensions bundled with Rhodes SDK make sure that the default application in your rhobuild.yml is the framework_spec:

app: [...]/rhodes/spec/framework_spec

To compile RhoSimulator with the custom native extensions change this path to your own Rhodes application home folder. It should be noted that extensions you’d like to compile into RhoSimulator should be listed in the main extensions section of your Rhodes application build.yml (but not in its platform-specific extensions sections).

Build RhoSimulator with rake command:

When you’ve finished all the preliminary steps for your OS, the only thing you need to do is to run the rake command in the rhodes source folder:

rake build:rhosimulator

To run Rhodes applications in the custom built RhoSimulator, please ensure that no env: » paths: » rhosimulator: line is present at your rhobuild.yml (if present, remove that line).

Build RhoSimulator for Windows in Visual Studio 2008:

  • Open the solution: <path-to-ruby>\lib\ruby\gems\<version-number>\gems\rhodes-<version-number>\platform\wm\rhodes.sln
  • Build solution for the configuration SimulatorRelease|Win32
  • Specify the path to custom built RhoSimulator at rhobuild.yml:
    env:
      paths:
        rhosimulator: platform/wm/bin/win32/rhodes/SimulatorRelease
    
Back to Top