Skip to Navigation | Skip to Content



To subscribe to all Nitobi blogs (highly recommended!), capture this feed here

March 18, 2010

Joe Bowser

A Tale of Two Androids

After being shown many more ways of writing applications on Android, I decided to investigate the possibility of using the V8 Javascript Engine in Android Scripting Environment. I saw what was done with the other platforms, so it should just be a simple matter of porting node. Unfortunately, I’m not there yet, so I started with what I know should exist, which is V8.

Blogs have it on good authority that Android Webkit now uses V8 as its Javascript Engine instead of JSC as it used to in previous versions of Android. Now, in the Android Open Source Project, the build system that is used there (which has even less documentation than the WebKit docs on the Android SDK), has the ability to compile every single module in Android independently. However, if you type the following:


make modules

You will notice that libv8 and v8shell are lacking. However, if you run this:


make modules JS_ENGINE="v8"

You will then notice that you will have access to these things. Given that most phone companies do their own builds of the OS, it’s not clear which phone has v8 and which phone does NOT have V8. I’m certain HTC knows this, but what about Motorola, Sony, LG, Dell, Acer or any of the other manufacturers of phone who all do their own builds and all have their own buildbots. It’d be great if you could find out which engine you were running on your phone, since WebKit can run many JavaScript engines, and soon we’ll be able to run Javascript on the phone wherever we want. Of course this is more pie in the sky than the reality, which looks like this:

adb shell
$ cd /tmp/
$ ./v8shell
V8 version 1.3.10 (candidate)
> print('Hello world');
Hello world
>

We’re working on it, and we’ll see what happens when this does exist. In the meantime, the DroidScript stuff is really interesting, and the more ways to develop on Android, the better. While some people are married to the idea of Java, I like the idea of writing whatever works for the developer. If anyone can recommend some solid books on Makefiles, that would be greatly appreciated. If I ever manage to get this to work, I’ll have an APK for download.

by Joe B at March 18, 2010 11:28 PM

March 12, 2010

Joe Bowser

Curiosity of the Day: DroidScript

Recently, a blog post came forward from Mikael Kindbord about running Rhino on Android. I was then asked to take a look at it,and it was pretty interesting. He recently released a project called DroidScript, which is actually really interesting. It’s an interesting front-end to Rhino, and it has the Javascript using Dalvik Android classes with Javascript so that you can have intents and invoke any method in Javascript that you can in Java. It does produce some pretty verbose code, and while I’m not going to re-structure Android PhoneGap so that it uses this just yet, it’s an interesting thought experiment in how many different ways you can write code for Android.

If you’re interested in Android and Javascript, I high recommend checking it out.

by Joe B at March 12, 2010 11:47 PM