Forum: JRuby Android app development

C4776b985756f7d835bb524ea37cd17d?d=identicon&s=25 lucky Developer (luckydev)
on 2010-06-17 06:39
I am excited about android and its development.

I want to start the android development using ruby /Jruby.

I have several doubts.

1. With JRuby, will I be writing ruby to create apps for android ?
2. Is JRuby stable enough to build android apps for our customers  ?
3. Where can I see the 'Getting Started' kind of information to jump
start android app development using JRuby ?

If you can, please point me towards a good resource for android
development using JRuby ..

Thanks
4bfcb18ca5298df54d8eb410244d004f?d=identicon&s=25 Uwe Kubosch (donv)
on 2010-07-19 00:46
(Received via mailing list)
On Jun 17, 2010, at 6:39 AM, lucky in ruby wrote:

> I am excited about android and its development.

This is a very late reply, but I guess you and many others wonder what
is happening.  I myself am not in the inner circle of Ruboto, but our
company has held a workshop experimenting with Ruboto, and we have
contact with the JRuby and Ruboto team, and they are very open on what
is going on.  I partly write this post to get confirmation or
corrections of my own assumptions from the JRuby / Ruboto team.  :)

Ruboto (JRuby on Android) has been released several times on the Android
Market.  Current version is 0.3.1.  Ruboto is a general programming
environment that lets you use all the standard Ruby classes and all the
Android Java classes just like JRuby does, with a few limitation.

Charles et al. please insert a bullet point of the Ruboto limitations
here, or a link to such a description :)

One limitation I have vaguely picked up is the inability for Ruby
classes to subclass Java classes.  This means, that all parts of the
Android API that requires your program to subclass a Java class or
implement a Java interface, you will not be able to access directly from
Ruby.    You can of course write a Java class to do the subclassing, and
access the java class from your Ruby code.  However that would be a lot
of work for something most every application would need.  That is part
of what the Ruboto team does for you.  A lot of this has been done, and
more is being done right now, partly as a Google Summer of Code project.
What has been done, and is in the 0.3.1 release, is an automatically
generated Ruby class that gives you access to all the Android Activity
classes together with their callback API.  That gives you access to all
the GUI components and more.  Next up is the Service API, and I expect
the full Android API to be available through Ruby pretty soon.

> I want to start the android development using ruby /Jruby.

Then you should just start doing it.  You will need to learn the Android
API regardless of which language you want to use.  Ruboto, like JRuby,
is running on the Java platform, and migrating an Android app from Java
to Ruby will not be much work.  You will probably spend more time
learning the Android API than on Ruboto.

One important thing that is being worked on right now, and which I have
been told should be available for developers in a couple of weeks, is
"ruboto-core".  This is an application template, possibly with a
companion generator.  Either use the generator or just make a copy of
ruboto-core, insert your application in the start.rb file, run rake to
make an apk application package, and deploy your application.  Nice!

We tried ruboto-core this thursday, and it worked fine for us, but the
Ruboto team has assured us that it will get even prettier this summer.

> I have several doubts.
>
> 1. With JRuby, will I be writing ruby to create apps for android ?

Yes.  You can write Ruby today, and insert some Java classes for very
special needs.  These special needs are what the Ruboto team are working
on, so you eventually can solve in Ruby only.

> 2. Is JRuby stable enough to build android apps for our customers  ?

Yes.  What is being worked on is functionality, not stability.  Ruboto
has not seen massive deployment yet, so issues are bound to appear when
usage increases, but I feel confident that issues will be dealt with in
the same manner as they are being addressed for JRuby.  In our workshops
we did not encounter any stabiltiy problems, at all.

> 3. Where can I see the 'Getting Started' kind of information to jump
> start android app development using JRuby ?

In the ruboto-irb application avaiable from the Android Market and
github, there are lots of great examples that show what you can do with
Ruboto today, and how you do it.

There is no active wiki, and no quick HOWTOs yet, and my guess is that
the core developers will not spend time on that anytime soon.  However,
there is not that much to learn that is Ruboto specific:  how to access
"special" APIs that are not directly accessible from Ruby code, and
packaging.  Both of these areas will probably be documented very soon,
when they are a bit more mature.  I am thinking this summer.

> If you can, please point me towards a good resource for android
> development using JRuby ..

http://github.com/ruboto
http://groups.google.com/group/ruboto
irc://irc.freenode.net/#ruboto
http://developer.android.com/



--
With kind regards
Uwe Kubosch
Kubosch Consulting
uwe@kubosch.no
http://kubosch.no/






---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Ab31d3cc98e2b20dd26dabdaaa962063?d=identicon&s=25 Alina Billingsley (alina92)
on 2013-12-20 07:47
I am a newbie and have basic idea of what programming is and a few basic
things such as loops,conditions,functions etc but I want to know what
are the requirements to create android app.

I am learning java but I wanna ask how much java to learn. I am stuck
and don't know what to do.
C983ad33b47479f17a28e083e1bb3d8b?d=identicon&s=25 Eric West (edubkendo)
on 2013-12-20 10:14
(Received via mailing list)
Hi Alina, this is a jruby users group. JRuby <http://jruby.org/> is not
java, its Ruby (a different programming language) running on the JVM
(Java
Virtual Machine). Ruby is a really great language, and in my opinion, an
easier language to start programming with than Java. With JRuby, and a
cool
project called Ruboto <http://ruboto.org/> it is certainly possible to
use
JRuby to write Android apps. But, depending on where you are in your
studies with Java, it might not be the quickest path to getting an app
written.

As for what you need to learn, it kind of depends on what kind of app
youd
like to make. Obviously, the more you learn about programming, the
easier
it will be to make apps, and the more complex and interesting the apps
you
make can be.

Android has a mailing list forum for developers like this one
here<https://groups.google.com/forum/#!forum/android-de...
people there might be more helpful for your particular question. They
also have a couple Google+ communities,
here<https://plus.google.com/communities/10515313437206...
here <https://plus.google.com/+AndroidDevelopers/posts>. Beyond that,
there
seems to be tons of resources out there for learning Android and getting
help.

Dont feel discouraged, programming can be hard but if you want to learn
how to do it, I am sure you can. The challenges make it so much more
rewarding than many other things you could be doing.

I assume that you are working through a book or course of some sort on
Java. Stick with that! If you work through a good solid book or course
like Deitels
Java: How to
Program<http://www.deitel.com/Books/Java/JavaHowtoProgram9...
then some Android specific resources, youll be in good shape to begin
making any app you want to. While a book like that wont teach you
everything you need to know, it will teach you enough that you can
easily
learn anything else you need when you need it. At least, thats been my
experience. If you dont have a book like that, there are tons of free
material for beginners out there on the internet, and you can learn to
program without spending a dime. One could learn most of the Java
language
directly from Oracles site, in fact: the Java
Tutorials<http://docs.oracle.com/javase/tutorial/>though those can be
kind of dry.

If you are interested in learning Ruby, there are tons of great
resources
for that too. To write Android apps, even with JRuby, youll still need
to
know some Java (so you can understand the Android documentation and the
objects you are working with, and have some idea of whats going on under
the hood when things in JRuby go wrong.) But in the end, many people
find
Ruby a much nicer language to work with. Of course, Im a Rubyist, so its
natural Id say that.
Some Ruby resources I can personally recommend:

RubyMonk <https://rubymonk.com>
CodeAcademy <http://www.codecademy.com/tracks/ruby>
Rails Tutorial <http://ruby.railstutorial.org/>

And many more I could link if you are really interested. That last is
more
about Web Development with Ruby on Rails <http://rubyonrails.org/> and
wont teach you much , if anything, directly about programming Android
apps, but I saw it described recently as the Ruby devs version of
building your own lightsaber and its so apt. Its a great way to learn a
ton of very important skills that any modern programmer will need like
testing, version control, basic command line skills and some of the
libraries and tools youll need in any ruby project of import.

Why would you possibly want to write Android apps with Ruby instead of
Java. Well, lets just look at some example code. First is some typical
Android Java code:

public class DisplayMessageActivity extends Activity {

    @SuppressLint("NewApi")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_display_message);

        // Make sure we're running on Honeycomb or higher to use
ActionBar APIs
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            // Show the Up button in the action bar.
            getActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

I took this from the Android Developers
site<http://developer.android.com/training/basics/first...
.

Now, heres some unrelated, but also typical Ruboto (JRuby library for
writing Android apps) code, taken from the Ruboto
wiki<https://github.com/ruboto/ruboto/wiki/Building-a-UI>:

require "ruboto/widget"

ruboto_import_widgets :EditText, :TextView, :Button, :LinearLayout
class RubotoDemoActivity
  def on_create(bundle)
    super
    # Create a proc to act as the buttons's click listener
    handle_click = proc do |view|
      @tv.append "\n#{view.getText}"
      @et.text = view.getText
    end
    setContentView(
      linear_layout(:orientation => :vertical) do
        @et = edit_text
        linear_layout do
          button :text => "Hello, World", :on_click_listener =>
handle_click
          button :text => "Hello, Ruboto", :on_click_listener =>
handle_click
        end
        @tv = text_view :text => "Click buttons or menu items:"
      end
    )
  endend

This is, of course, to some extent subjective, but I know which one I
find
easier to read, simpler to reason about, and just plain more pleasant to
look at. And the Ruby community is amazing and one of a kind. Of course,
there are some cons to using ruby. Its performance is slower (though in
many apps this isnt truly that big a deal), when it is, you can always
write part of the app in Java if you need.

Whichever language you go with, if your desire is to build Android apps,
then you ought to start building Android apps today. While you work
through
any of this other material. find some really basic step-by-step Android
app
tutorials and just start following along. This one, Android Programming
Tutorial <http://www.tutorialspoint.com/android/> for instance, looks
like
you can just follow each step and get a basic Hello World app running .
Once you get it working following their directions, see what you can
change
, make the text say something different (I like to be a bit juvenile and
change it to dirty words sometimes if Im at home by myself and working
through a tutorial of some sort), make it a different color, make it do
something different. Anything you can figure out to change about it.
Then,
when you sit there, realizing that the change you just made on the
machine
was because of something you did, youll begin to feel the magic.

So, definitely keep learning Java (or Java plus Ruby), but as you work
through that book or class or whatever, and you do a few exercises, stop
and switch gears, and spend a little time doing Android specific stuff.
Especially at those times when you are feeling stuck and discouraged.

I dunno if you posted this here because you are actually interested in
Ruby, or if it was just an accident or misunderstanding, but I wanted to
pass along a bit of encouragement to you, and some resources to help you
on
your way. Why? Because it was only a very short time ago that I knew
nothing at all about programming, and decided I wanted to learn. And
now,
after just a year and a half or so of very hard work, I have worked on
some
awesome projects with some of the smartest programmers in opensource,
been
to my first RubyConf, and have started interviewing for professional
jobs
with starting salaries earning more than I ever made in my life. And I
love
programming. I feel empowered. When there is something I want to code,
if I
feel like spending the time and energy to code it, I feel totally
capable
of doing so. You will get there too.

I can remember that feeling of being stuck, wanting to make apps, and
just
not knowing where to start, or how long it would take. The answers
turned
out to be: Start where I am, and just keep learning. and Longer than I
would have liked, but a lot less time than I feared. And remember, youll
get out what you put in.

Hope this helps.
Cheers,
Eric
Abdb670e1c130f96f947a94d03c02efa?d=identicon&s=25 Eric Christopherson (echristopherson)
on 2013-12-21 00:29
(Received via mailing list)
On Dec 20, 2013 3:13 AM, "Eric West" <esw9999@gmail.com> wrote:
>
> Hi Alina, this is a jruby user’s group. JRuby is not java, it’s Ruby (a
different programming language) running on the JVM (Java Virtual
Machine).
Ruby is a really great language, and in my opinion, an easier language
to
start programming with than Java. With JRuby, and a cool project called
Ruboto it is certainly possible to use JRuby to write Android apps. But,
depending on where you are in your studies with Java, it might not be
the
quickest path to getting an app written.
...
> I dunno if you posted this here because you are actually interested in
Ruby, or if it was just an accident or misunderstanding, but I wanted to
pass along a bit of encouragement to you, and some resources to help you
on
your way. Why? Because it was only a very short time ago that I knew
nothing at all about programming, and decided I wanted to learn. And
now,
after just a year and a half or so of very hard work, I have worked on
some
awesome projects with some of the smartest programmers in opensource,
been
to my first RubyConf, and have started interviewing for professional
jobs
with starting salaries earning more than I ever made in my life. And I
love
programming. I feel empowered. When there is something I want to code,
if I
feel like spending the time and energy to code it, I feel totally
capable
of doing so. You will get there too.
>
> I can remember that feeling of being stuck, wanting to make apps, and
just not knowing where to start, or how long it would take. The answers
turned out to be: “Start where I am, and just keep learning.” and
“Longer
than I would have liked, but a lot less time than I feared.” And
remember,
you’ll get out what you put in.
>
> Hope this helps.
> Cheers,
> Eric

Eric, what a great reply. I feel motivated by it, myself.

>
>
>
> On Fri, Dec 20, 2013 at 12:47 AM, Alina Billingsley <lists@ruby-forum.com>
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.