News

 
  • 11 Dec

    Announcing RubyMotion 3.0: Android Platform, WatchKit Apps, and More

    We recently just turned 3 years old, and today we are excited to announce the immediate availability of RubyMotion 3! We worked a lot on this release and we hope you will enjoy it. Let's dive in!

    Android Platform

    The RubyMotion Android support that we released in public beta a few weeks ago has been integrated into the stable release.

    If you have been following our pre-release channel you might have seen that we have been doing several updates and following several customers using it. We now believe that the support is good enough to be used by everyone, and we woulc like to encourage that.

    As of RubyMotion 3, we support all versions of Android, up to the latest one (5.0 Lollipop). You can call into the entire set of Java APIs for these platforms, and you can also integrate 3rd-party Java libraries.

    The interactive console that you know and love from iOS is available when running in the emulator and in the device.

    A debugger interface, based on ndk-gdb, is available. You can simply pass the debug=1 argument to the rake emulator or rake device tasks. You can set breakpoints, inspect backtraces, variables, and more. This is possile since our compiler generates proper DWARF metadata for your Ruby code.

    $ rake device debug=1
    ...
    (gdb) break main_activity.rb:16
    Breakpoint 1 at 0x5ec294d0: file main_activity.rb, line 16.
    (gdb) continue
    ...
    

    Finally, a spec framework is available. This is the exact same framework used in iOS and OS X projects, so you should feel at home. Specs can run on both the emulator and the device, using the respective rake spec:emulator and rake spec:device tasks.

    $ cat spec/main_spec.rb 
    describe "Main activity" do
      it "has a title" do
        main_activity.title.should == "Hello"
      end
    end
    
    $ rake spec:device
    ...
    I/com/yourcompany/hello( 2024): Main activity
    I/com/yourcompany/hello( 2024):   - has a title
    I/com/yourcompany/hello( 2024): 1 specifications (1 requirements), 0 failures, 0 errors
    

    For more information about the Android support in RubyMotion, check out the following guides:

    As a side note, now that Android support is in the stable release we recommend that you update your RubyMotion Android projects to point to /Library/RubyMotion/lib (and not /Library/RubyMotionPre/lib).

    WatchKit Apps

    As of 3.0 RubyMotion lets you write Apple Watch apps in Ruby using WatchKit.

    A WatchKit app is linked to an existing iOS app, as an extension. To create a WatchKit app in RubyMotion, you will first need to install the latest build of Xcode 6.2, which comes with iOS 8.2 Beta. Then, simply use the ios-watch-extension template inside an existing iOS project.

    $ motion create --template=ios MyHostApp
    $ cd MyHostApp
    $ motion create --template=ios-watch-extension MyWatchApp
    

    Then, configure the project's Rakefile to include the WatchKit extension:

    Motion::Project::App.setup do |app|
      ...
      app.target "./MyWatchApp", :extension
    end
    

    Finally, you can run the watch app in the simulator:

    $ rake watch
    

    WatchKit support is still in development and will be improved in future updates. For more information about WatchKit, make sure to read Apple's WatchKit Programming Guide.

    Finally, there has been several recent important changes that we didn't cover in our blog.

    iOS 8 Extensions

    iOS 8 introduces extensions, which let apps extend their functionality and become available to users while they are using other apps.

    RubyMotion lets you create iOS 8 extensions through a myriad of templates:

    • ios-action-extension
    • ios-custom-keyboard
    • ios-document-picker
    • ios-file-provider
    • ios-photo-editing
    • ios-share-extension
    • ios-today-extension
    • ios-watch-extension

    For more details, check out the ExtensionsAndFrameworks project in our samples repository.

    iOS 64-bit

    As you might have heard, the iOS App Store will require apps to be compiled for 64-bit before a submission in February 2015.

    RubyMotion supports ARM 64-bit since some time. We recently improved the 64-bit support in both the compiler and the runtime, and as of RubyMotion 3.0, iOS apps will now compile for 64-bit by default.

    If you enabled 64-bit in your project Rakefile, you can now safely remove that, since it will build for 64-bit.

    Application Size Reduction

    RubyMotion apps are statically compiled into machine code. If your project has a lot of Ruby files, this can lead to a pretty big binary at the end.

    We have been working on reducing the code size of the object files that the compiler generates. In a recent update, the size of RubyMotion executables has been reduced from 30% to 60%, on average.

    We are not done yet and we will keep improving the toolchain to generate apps that are as small as possible.

 
 

Want to stay in touch?

Follow us on Twitter