ruby on android : ruboto vs rhodes? - android

Has anyone tried developing an Android app using Ruby? If so, which tool would you recommend?
What are the advantages and disadvantages, comparing (between) both?
Any sharing of experience, insight, etc., would be much appreciated.

Disclamer: I haven't used this project at all. Having said that:
The Mirah programming language's syntax is based heavily on Ruby and it compiles to Java byte code which you could then run through the dx android tool.
Another option to consider would be JRuby. JRuby is a fairly mature implementation of Ruby which, I believe, supports ahead of time compilation.

Rhodes uses compiled Ruby 1.9 bytecode at run time, and does not use the Dalvik JVM at all (it's written in C++ with the NDK). Hence, it is much faster than Ruboto.

Related

Running Python Script from Android Activity

I am collecting some data from my android application. How to run a python script in my android application that uses the collected data as input and generates some output?
Consider Jython, Jython is an implementation of the high-level, dynamic, object-oriented language Python seamlessly integrated with the Java platform. The predecessor to Jython, JPython, is certified as 100% Pure Java.
mbedded scripting - Java programmers can add the Jython libraries to
their system to allow end users to write simple or complicated
scripts that add functionality to the application.
Interactive experimentation - Jython provides an interactive
interpreter that can be used to interact with Java packages or with
running Java applications. This allows programmers to experiment and
debug any Java system using Jython.
Rapid application development - Python programs are typically 2-10X
shorter than the equivalent Java program. This translates directly
to increased programmer productivity. The seamless interaction
between Python and Java allows developers to freely mix the two
languages both during development and in shipping products.
The awesome features of Jython are as follows,
Dynamic compilation to Java bytecodes - leads to highest possible
performance without sacrificing interactivity.
Ability to extend existing Java classes in Jython - allows effective
use of abstract classes.
Jython doesn't compile to "pure java", it compiles to java bytecode subsequently to class files. To develop for Android, one compile java bytecode to Dalvik bytecode. To be honest, this path of development is not official , thus you will run into lots of problem with compatibility of course.
You may use qpython,
QPython is a script engine that runs Python on android devices. It
lets your android device run Python scripts and projects. It contains
the Python interpreter, console, editor, and the SL4A Library for
Android. It’s Python on Android! It offers the development kit which
lets you easily develop Python projects and scripts on your Android
device.
If you need to add some specifics libraries, according to qpython documentation install-libraries :
You can install most pure python libraries through pip_console.py
which included from the 0.9.8.2 version
You may add --no-use-wheel argument when using pip_console.py to avoid unknown archive format :whl issue when installing some package.
and / or
You can upload your libraries into the
/sdcard/com.hipipal.qpyplus/lib/python2.7/site-packages or
/sdcard/com.hipipal.qpyplus/lib/python3.2/site-packages (For QPython3)
Regards

Difference between SDK and NDK in android

Since 2 Years I am working as Android Application Developer. I generally use android SDK for all the Android Apps Development. Now I have a project which is an Android App in which I have to use SDK as well as NDK for App development (As per Client requirement).
But as I don't have any experience with NDK I don't know what is it. In some Blogs I have read that NDK development is based on c++.
Is it true that to work with NDK one must have the complete knowledge of c++ ?
Please Help !!
Use of NDK means you have to write portion of code in C/C++ just to achieve the speed. If it is client requirement then you have no option. But keep in mind that you should use NDK only when you feel you need better performance. And of course you must have some understanding of c/c++ to use NDK.
NDK
NDK is a set of tools to compile C code to shared lib,
which you could use in your app - and that's all.
Enables legacy code re-use between iOS and Android platforms
Good for implementing CPU intensive operations that don't
allocate much memory like signal processing, physics simulations.
SDK
SDK is the main development kit for Android apps - it contains tools for Java and resources (png, xml) compiling, packaging to apk file, installing, running and debugging them on a device, an emulator, documentation, etc.
Java has superior memory management model Superior threading model Better exception handling model Rich set of libraries Superior support for unicode characters.

Using mixed Java/Ruby code in an Android app?

Is it possible to write part of the Android app in Ruby and then, using JRuby and Android Tools, compile the code to run on Dalvik VM? I don't need any run-time support for interpreting Ruby code, just to run one Ruby module. It would be nice if the compiled code is minimal, to not drag along the entire Ruby standard library.
How to configure some IDE (like Eclipse) and Android Tools to support that?
See these/three/answers (on stackoverflow) regarding #CharlesOliverNutter 's Ruby-like Mirah language that runs on the Dalvik VM.
Have a look at Ruboto.
Some time ago I was working on a debug lib for android that was using it but I got out of time. I looked at the ruboto-irb source code a lot.
The major downside I came up is that it needed to have ruboto installed on the device.

What languages are mature to develop native apps in Android [except Java]

Is there a languages other then Java to develop native apps in android without script layer/AIR and others 3rd party abstractions.
Mostly im interested in Clojure,JRuby, Scala
Since Scala is compiled to native JVM bytecode, it could be use to develop native Android apps.
The biggest problem is that using 3rd party library is not that easy in Android development, and you need use proguard to reduce the size of your program, sometimes this will cause problem.
But it is still feasible to develop an Android app using Scala, for example, I've wrote an little android app (page in Chinese, but there is screenshots) using Scala. It's not a complex app, but should demonstrate what Scala could do in Android app development.
Here is also an SBT plugins that help you build your Scala/Android program.
Finally, if you want develop Android using Scala, I will suggest using Scala 2.8.x. I found my program crashes during adb install when I extends a collection class using Scala 2.9.
If you use Mirah, you can get code that is exactly as fast and small as writing Java, but you get niceties like type inference, closures, and macros. The tooling is still pretty immature compared to Scala, but if you want to minimize overhead above all else you should give it a look: http://mirah.org and https://github.com/mirah/pindah

gcc -x objective-c with Android SDK

Since Objective-C exists and is supported even in MinGW, by passing -x objective-c, is there a hack to achieve this with Android SDK? I've did a rudimentary test on a colleague's machine where it appears that language objective-cis not supported.
I am not interested in getting UIKit or AppKit, or even Foundation, to work; I've written most of an OpenGLES game in Objective-C, and successfully ported it to Mac OS X and Windows; I am fairly certain I could easily port it to GNU/Linux once I get time to figure out enough of GNUStep (and even without it, I could create the classes to get the game running).
I'm just interested in the base language and basic runtime (including properties, if possible); even NSObject can be easily written to the extent I need it.
In the meantime, I've managed to compile some Objective-C code, and have written a guide for this:
Developing Objective-C apps for Android using Mac OS X
There are more details in my answer below.
The Apportable platform includes a Clang compiler integration with the Android NDK. It also includes a bunch of other useful features if you want to go beyond basic Objective-C language and runtime support.
You probably have to recompile the ndk gcc's sources with that option enabled. At the extreme you might have to find the code for that option upstream and add it to the ndk gcc's sources.
Porting runtime libraries to work on top of bionic instead of glibc may be more interesting.
Note that android doesn't really handle pure-native binaries very well, you will need to either be called as a jni library from a java wrapper application which you will have to call back up through for audio or forked and exec'd off of one (not recommended, and leaving you with device-dependent hacks for audio).
There is this Google Code project: http://code.google.com/p/android-gcc-objc2-0/ however I have not tested it yet.
Also, I have inquired on the Cocotron mailing list whether or not this compiler is usable with Cocotron's Foundation and CoreFoundation; one person responded that it is not, and that he has worked on the problem: http://groups.google.com/group/cocotron-dev/browse_thread/thread/448355f2a6c9c28e#
In the meantime, I've managed to compile some Objective-C code, and have written a guide for this:
* Developing Objective-C apps for Android using Mac OS X
Clang is included in NDK nowadays if that's all you need.

Categories

Resources