top | item 7812586

RubyMotion 3.0 Sneak Peek: Android Support

218 points| blacktulip | 11 years ago |blog.rubymotion.com

76 comments

order
[+] danielsju6|11 years ago|reply
Maybe it's petty but I've lost confidence in Ruby Motion since I've had a pull request open against it for whole year because they don't support enterprise deployment out of box. The fix is pretty damn simple too https://github.com/HipByte/RubyMotion/pull/64/files

You'd think enterprise would be a prime use case here. Sucks to have to keep your own fork up to date.

Moral of the story, if you have a Github repo please accept pulls; and if you don't you loose customers.

[+] phillmv|11 years ago|reply
I'm just smiling at the juxtaposition. It's amusing what in most circumstances would be a fact of life becomes a major sticking point. Apple doesn't take pull requests. I'm sure Google accepts patches, sometimes, but the process doesn't strike me as quite on the PR-level of ease.

Is the alternative PhoneGap, and the hypothesis that they're more responsible with taking ownership of your pet features? Just curious.

[+] colinta|11 years ago|reply
Hi James, it's mostly my fault that your PR hasn't been merged. We tend to focus a lot on the compiler, and less on the Rake commands, but I'll try and get these PRs taken care of soon.
[+] voltagex_|11 years ago|reply
Might I suggest posting a comment on that pull just to bump it?
[+] bratsche|11 years ago|reply
"The object model of RubyMotion for Android is based on Java. Ruby classes, objects, methods and exceptions are Java classes, objects, methods, and exceptions, and vice-versa. No bridge is involved."

But then later it says "The runtime uses the Java Native Interface (JNI) in order to integrate with Java".

And then later it says, "RubyMotion Android apps are fully compiled into optimized machine code, exactly like their iOS and OS X counterparts."

Does any of this make any sense? They seem to be contradicting themselves left and right on the same page.

[+] mfkp|11 years ago|reply
"RubyMotion for Android features a completely new Ruby runtime specifically designed and implemented for Android development."

That is huge, very excited to check this out!

I would love being able to write ruby instead of java (whereas objc doesn't bother me that much).

[+] infraruby|11 years ago|reply
> I would love being able to write ruby instead of java

You can do that with InfraRuby (http://infraruby.com/) if you don't mind writing type annotations.

[+] georgedrummond|11 years ago|reply
How does this differ from Ruboto http://ruboto.org/?

I've only just started playing with Rubymotion and it does seem very nice. I'm excited its going to support Android too but Ruboto is another piece of technology that also looks exciting.

[+] martijn_himself|11 years ago|reply
You can't 'check it out' though unless you pay £123.47 for the privilege.
[+] scoot|11 years ago|reply
I just wish they'd release an LOC limited trial version. I'd love to give it a spin, but I'm not about to fork out that much money just to try it...
[+] Karunamon|11 years ago|reply
Likewise. $200 is a lot of money to throw down on something sight unseen, money back guarantees or otherwise.
[+] hipcactus|11 years ago|reply
Can anyone confirm the 30 day guarantee?
[+] afternooner|11 years ago|reply
I agree, and the 30 day trial isn't enough. It would be side projects, so I may get to hack on it for a day and maybe a night or two. I can write Obj-C, and Java, they just aren't as intuitive or enjoyable to me. And lets face it, $200 is just too much to spend when RubyMotion may not exist for version 4, and then I have an entire application that needs to be ported into Obj-C and Java... And a promise of open sourcing it doesn't help, because there may be no maintainers. IronRuby, now that C# has dynamics, would be awesome. But it hasn't been updated in 3 years. I'd even drop $100 sight unseen. But $200... Noooope.
[+] lnanek2|11 years ago|reply
I was impressed that even with all this translation and Java compatibility going on, the sample code still shows some situations where the nice clean, concise nature of Ruby is still up and running. E.g.:

> @paths.each { |path, paint| canvas.drawPath(path, paint) } if @paths

From: https://github.com/HipByte/RubyMotionSamples/blob/master/and...

And: @activity.handler.post -> { @activity.updateTimer }

From: https://github.com/HipByte/RubyMotionSamples/blob/master/and...

These things take a lot of lines in Java for Android where we don't have lambdas and function references yet and often have to define anonymous classes just to pass a method in to a handle to be run later.

[+] crashandburn4|11 years ago|reply
I was just looking at the rubymotion licences [0]. does anyone know if you will get future releases with the licence? do you only get them for one year?

[0] http://sites.fastspring.com/hipbyte/product/rubymotion

[+] ptomato|11 years ago|reply
> does anyone know if you will get future releases with the licence?

Yes.

> do you only get them for one year?

Yes, though license renewal costs $100, not $200.

[+] sciguy77|11 years ago|reply
I am elated. Rubymotion is awesome. It has the ease of PhoneGap with the speed of native Obj-C.
[+] stephenhuey|11 years ago|reply
I just downloaded it and am impressed so far. Looks like it'll be an extra bonus since I won't have to also learn Ruboto to write Android apps with Ruby.
[+] yulaow|11 years ago|reply
Surely today with this news, the one on xamarin and that on codenameone it is likey orgasm-day for all the crossplatform tools lovers.
[+] mark_l_watson|11 years ago|reply
Does anyone know if the RubyMotion price of $200 will include Android support, or will that be a separate product?
[+] blacktulip|11 years ago|reply
It is most likely all included in one product. If it is a separate product it would not use --template `motion create --template=android Hello`
[+] octopus|11 years ago|reply
This is great news, it will boost the adoption of Ruby and RubyMotion in the huge Android market.

Finally I have a reason to give RubyMotion a try. I'm curious how much productivity gain can one achieve with a language like Ruby once it is compiled (which will ensure the speed of the resulting application).

[+] colinta|11 years ago|reply
I think the gains are huge, but it depends on your preferred workflow. I know some traditional Xcode developers who kick and scream at the idea of loosing their IDE, whereas I prefer to live in the terminal.

Workflow is one thing, but then writing Ruby code is so fluid. Notice that there's not a lot of preamble (imports and such) that you need to take care of in the Ruby code, I think that's great. But, again, language and workflow are very personal, and I think every tends to "think they're right" ;-)

[+] rahilsondhi|11 years ago|reply
Are mobile apps written with RubyMotion on par with the native equivalent? For example, I've heard a lot of people dislike PhoneGap, AppAccelerator, etc because the final app isn't as polished as something that is built natively.
[+] wuliwong|11 years ago|reply
I would assume that the process for Android is much different than iOS or OS X. In the latter cases, the ruby is compiled to the same "stuff" that objective-C is compiled into. As for Android, I'm not totally sure. My experience with some apps written using rubymotion (http://www.rubymotion.com/apps/) they seem to run very fluid on my iphone 5s. The original product was macruby which was exclusively for writing OS X apps using ruby. My understanding is that that framework produced great results which spurred the continuation to iOS and now Android.

I'm a "full-stack" web developer using mostly rails these days. I've only begun to try out rubymotion but it seems fantastic for someone like myself. In my nights and weekends , I am continually working on my own startup. Releasing any sort of mobile app was daunting, particularly on iOS. I have some Android experience but zero Objective-C. Phonegap and "the like" just didn't seem to deliver a product which would even satisfy my definition of "MVP". I could be wrong but that is just my impression. In fact, Phonegap turned out to be significantly more complex to figure out than I expected. When I found rubymotion, I had some basic apps written, which were hitting live API's I had created. They aren't simple but they are legitimately native, so they have the ability to run smooth and fast.

My hope is that a lot of what I write will be usable on both iOS and Android but at first blush, that might be difficult to pull off. Maybe someone will create a framework which sits on top of rubymotion which allows you to create one app which compiles down to both an .apk and whatever iOS needs? hahahah. I laugh but someone probably already is working on it.

[+] cmelbye|11 years ago|reply
Yes, it says that in the announcement:

> The object model of RubyMotion for Android is based on Java. Ruby classes, objects, methods and exceptions are Java classes, objects, methods and exceptions, and vice-versa. No bridge is involved.

You're still coding to the same native APIs, but you're doing it in Ruby. That's how RubyMotion works on iOS/OSX as well as Android now.

[+] dimillian|11 years ago|reply
Hey, when it comes to mobile, I develop them in pure Objective-c for iOS, and pure Java for Android. I use tools provided by both compagnies. So yeah, I do the jobs twice, but I think it's ok.

Anyone have feedbacks coming from what I do to something like RubyMotion or Xamarin? These solutions sound very interesting, but I've yet to try them. I think I'm too attached to my Objective-c and workflow.

Also, is there peoples who originally used RubyMotion or Xamarin and went to use OC and Java?

[+] colinta|11 years ago|reply
If you already have a comfortable work flow, I would not encourage you to migrate just for the sake of it, but having the option to write a native app in Ruby is very compelling to a lot of people who might otherwise not be interested in writing a native mobile app.

RubyMotion supports xib files, storyboards, xcdatamodel files, and Android XML files (and localization files, etc), so if you ARE interested in switching, you don't have to stop using those if you're already used to them.

[+] fuddle|11 years ago|reply
I'm curious if the XML views will remain the same?
[+] chrisdevereux|11 years ago|reply
Presumably yes if it uses native APIs. On iOS, although .nib files are supported, people tend to prefer Ruby DSLs to define interfaces though. I imagine that something similar will happen on Android.

Expect that it won't be long before somebody comes out with a cross-platform wrapper for native UI elements similar to Xamarin 3.0.

[+] colinta|11 years ago|reply
Yes, XML based layouts work just like they do in traditional Android development.

And to chrisdevereux's point, we've already got some Android support in MotionKit.

[+] gary4gar|11 years ago|reply
does this work on all android versions?
[+] andyl|11 years ago|reply
This is fantastic news. I love RubyMotion and can't wait to try it on Android. Especially want to learn how easy it will be to create wrapper objects to have a common API across platforms.