Android + JRuby?

  • Thread starter dangerwillrobinsondanger
  • Start date
D

dangerwillrobinsondanger

Hey Mr. Nutter...
Any idea if JRuby will work on Android???
Sure would be cool to have a Ruby angle on phone software, even
though there is no Android phone yet...
 
C

Charles Oliver Nutter

John said:
Hey Mr. Nutter...
Any idea if JRuby will work on Android???
Sure would be cool to have a Ruby angle on phone software, even though
there is no Android phone yet...

Unless it has Java support, probably not...though there are medium an
large scale Java phones that probably could be made to run JRuby. We're
definitely interested in the possibilities :)

Anyone know more about Android and whether it could run Ruby in some form?

- Charlie
 
J

John Joyce

Unless it has Java support, probably not...though there are medium
an large scale Java phones that probably could be made to run
JRuby. We're definitely interested in the possibilities :)

Anyone know more about Android and whether it could run Ruby in
some form?

- Charlie
From what I could gather, it does have Java support or is at least
written in Java.
Being supposedly open (we'll find out next week I guess...) this
could be an interesting in ...
 
S

Shajith

Unless it has Java support, probably not...

The Android SDK was just announced, and it the application layer is in Java!
Details here: http://code.google.com/android/index.html

The VM seems to require transformation of Java byte code to a
different format (dex) through a provided tool. It's not clear whether
this means that anything that compiles to normal Java bytecode is good
to go. Can you confirm?

Shajith
 
J

John Joyce

The Android SDK was just announced, and it the application layer is
in Java!
Details here: http://code.google.com/android/index.html

The VM seems to require transformation of Java byte code to a
different format (dex) through a provided tool. It's not clear whether
this means that anything that compiles to normal Java bytecode is good
to go. Can you confirm?

Shajith
As I suspected, the project actually e-mailed me back about it last
Friday night, with a hint, hint, nudge, nudge about it and look at
things Monday. Sure enough, there it is.
So looks like Java is moving into the embedded world now.
Now the only clincher is seeing this thing hit the market, which it
most likely will.
The Japanese handset makers involved are all desperate to stay in
their domestic market and stop reinventing the wheel every six months...
I'm thinking Ruby phone via JRuby...
 
C

Charles Oliver Nutter

John said:
Hey Mr. Nutter...
Any idea if JRuby will work on Android???
Sure would be cool to have a Ruby angle on phone software, even though
there is no Android phone yet...

From a cursory glance at the SDK, I'd say...yes!

I'm not sure yet if everything we need is there, but it would be
considerably easier to bring JRuby up on Android than on Java ME. Most
of the packages I expected to be missing are present...so I think
there's a good chance it could be made to run.

- Charlie
 
B

brabuhr

From a cursory glance at the SDK, I'd say...yes!

I'm not sure yet if everything we need is there, but it would be
considerably easier to bring JRuby up on Android than on Java ME. Most
of the packages I expected to be missing are present...so I think
there's a good chance it could be made to run.

A simple test: adding jruby-complete.jar onto the dex call in build.xml:

dex:

[exec] UNEXPECTED TOP-LEVEL EXCEPTION:
[exec] com.google.util.ExceptionWithContext: address not yet known
[exec] at
com.google.util.ExceptionWithContext.withContext(ExceptionWithContext.java:46)
[exec] at
com.google.dex.cf.CfTranslator.processMethods(CfTranslator.java:375)
[exec] at
com.google.dex.cf.CfTranslator.translate0(CfTranslator.java:153)
[exec] at
com.google.dex.cf.CfTranslator.translate(CfTranslator.java:117)
[exec] at com.google.command.dexer.Main.processClass(Main.java:362)
[exec] at com.google.command.dexer.Main.processFileBytes(Main.java:346)
[exec] at com.google.command.dexer.Main.processArchive(Main.java:311)
[exec] at com.google.command.dexer.Main.processOne(Main.java:233)
[exec] at com.google.command.dexer.Main.processAllFiles(Main.java:169)
[exec] at com.google.command.dexer.Main.run(Main.java:126)
[exec] at com.google.command.dexer.Main.main(Main.java:107)
[exec] at com.google.command.Main.main(Main.java:51)
[exec] Caused by: java.lang.RuntimeException: address not yet known
[exec] at com.google.dex.code.DalvInsn.getAddress(DalvInsn.java:162)
[exec] at
com.google.dex.code.TargetInsn.getTargetOffset(TargetInsn.java:110)
[exec] at com.google.dex.code.form.Form20t.branchFits(Form20t.java:67)
[exec] at
com.google.dex.code.OutputCollector.fixBranches(OutputCollector.java:429)
[exec] at
com.google.dex.code.OutputCollector.assignAddressesAndFixBranches(OutputCollector.java:382)
[exec] at
com.google.dex.code.OutputCollector.finishProcessingAndGetList(OutputCollector.java:117)
[exec] at
com.google.dex.code.RopTranslator.translateAndGetResult(RopTranslator.java:204)
[exec] at
com.google.dex.code.RopTranslator.translate(RopTranslator.java:98)
[exec] at
com.google.dex.cf.CfTranslator.processMethods(CfTranslator.java:346)
[exec] ...10 more
[exec] ...while processing <clinit> ()V
[exec] ...while processing org/jruby/parser/DefaultRubyParser.class

[exec] 1 error; aborting
 
B

brabuhr

From a cursory glance at the SDK, I'd say...yes!

I'm not sure yet if everything we need is there, but it would be
considerably easier to bring JRuby up on Android than on Java ME. Most
of the packages I expected to be missing are present...so I think
there's a good chance it could be made to run.

A simple test: adding jruby-complete.jar onto the dex call in build.xml:

[exec] ...while processing org/jruby/parser/DefaultRubyParser.class
[exec] 1 error; aborting

And copying the entire JRuby source into the Android project.
(Removed BSFExample.java and demo since java.awt and javax.swing did
not exist.):

compile:
[javac] Compiling 621 source files to
/nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/bin/classes
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:38:
package java.beans does not exist
[javac] import java.beans.BeanInfo;
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:39:
package java.beans does not exist
[javac] import java.beans.IntrospectionException;
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:40:
package java.beans does not exist
[javac] import java.beans.Introspector;
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:41:
package java.beans does not exist
[javac] import java.beans.PropertyDescriptor;
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/bsf/JRubyEngine.java:64:
cannot access java.beans.PropertyChangeListener
[javac] class file for java.beans.PropertyChangeListener not found
[javac] public class JRubyEngine extends BSFEngineImpl {
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:969:
cannot find symbol
[javac] symbol : class BeanInfo
[javac] location: class org.jruby.javasupport.JavaClass
[javac] BeanInfo info;
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:972:
cannot find symbol
[javac] symbol : variable Introspector
[javac] location: class org.jruby.javasupport.JavaClass
[javac] info = Introspector.getBeanInfo(javaClass());
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:973:
cannot find symbol
[javac] symbol : class IntrospectionException
[javac] location: class org.jruby.javasupport.JavaClass
[javac] } catch (IntrospectionException e) {
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/JavaClass.java:977:
cannot find symbol
[javac] symbol : class PropertyDescriptor
[javac] location: class org.jruby.javasupport.JavaClass
[javac] PropertyDescriptor[] descriptors =
info.getPropertyDescriptors();
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jvyamlb/RepresenterImpl.java:393:
warning: non-varargs call of varargs method with inexact argument type
for last parameter;
[javac] cast to java.lang.Object for a varargs call
[javac] cast to java.lang.Object[] for a non-varargs call and to
suppress this warning
[javac] values.put(pname,
ems.invoke(data,null));
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/bsf/JRubyEngine.java:130:
cannot find symbol
[javac] symbol : variable super
[javac] location: class org.jruby.javasupport.bsf.JRubyEngine
[javac] super.initialize(manager, language, someDeclaredBeans);
[javac] ^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/bsf/JRubyEngine.java:141:
cannot find symbol
[javac] symbol : variable this
[javac] location: class org.jruby.javasupport.bsf.JRubyEngine
[javac]
runtime.getGlobalVariables().defineReadonly("$bsf", new
FunctionsGlobalVariable(runtime, new BSFFunctions(manager, this)));
[javac]
^
[javac] /nas/projects/cameron/public/android_sdk_linux_m3-rc20a/JRubyTest/src/org/jruby/javasupport/bsf/JRubyEngine.java:234:
cannot find symbol
[javac] symbol : variable super
[javac] location: class org.jruby.javasupport.bsf.JRubyEngine
[javac] super.terminate();
[javac] ^
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 12 errors
[javac] 1 warning

BUILD FAILED

Oh, this was JRuby-1.0.2 in both cases.
 
C

Charles Oliver Nutter

From a cursory glance at the SDK, I'd say...yes!

I'm not sure yet if everything we need is there, but it would be
considerably easier to bring JRuby up on Android than on Java ME. Most
of the packages I expected to be missing are present...so I think
there's a good chance it could be made to run.

A simple test: adding jruby-complete.jar onto the dex call in build.xml:

dex:

[exec] UNEXPECTED TOP-LEVEL EXCEPTION:
[exec] com.google.util.ExceptionWithContext: address not yet known
[exec] at
com.google.util.ExceptionWithContext.withContext(ExceptionWithContext.java:46)
[exec] at
...

Looks like a bug in Android SDK. It's deep into Google's code from
something of ours that shouldn't be doing anything too weird...

- Charlie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top