17 Comments

Summary:

Google is looking to replace Dalvik, the software that lets you run software on Android. The new runtime is called ART and if you have Android 4.4, you can start testing it now.

ART and Dalvik

After a 2010 spat over how Java works in Android with Oracle, Google is moving on to a new way for apps run on mobile devices. Dubbed ART, the new runtime environment is available as a preview option in Android 4.4. Developers are encouraged to try it and provide feedback for ART and if you have Android 4.4, you can test it yourself although you may not see much difference just yet.

On a sparse web page for developers, Google said the new runtime is experimental and a work in progress. You can enable it in Android 4.4 through the Settings, Developer Options menu. I did just that on a Nexus 5 and after a reboot, Android spent about 10 minutes optimizing my apps to run. I don’t yet see any difference in the apps.

Currently, Android apps run in what’s called Dalvik, a runtime environment that compiles Java bytecode “just in time” so that Android can run it. Essentially, it’s the software that lets you run software in Android. So what is ART and why should you care? Check this overview from Cody Toombs at Android Police for a better understanding:

“ART, which stands for Android Runtime, handles app execution in a fundamentally different way from Dalvik. The current runtime relies on a Just-In-Time (JIT) compiler to interpret bytecode, a generic version of the original application code. In a manner of speaking, apps are only partially compiled by developers and the rest of the compilation is completed on a user’s device each and every time they are run. The process involves a lot of overhead and isn’t particularly efficient, but the mechanism makes it easy for apps to run on a variety of hardware and architectures. ART is set to change this process by pre-compiling that bytecode into machine language when apps are first installed, turning them into truly native apps. This process is called Ahead-Of-Time (AOT) compilation. By removing the need to spin up a new virtual machine or run interpreted code, startup times can be cut down immensely and ongoing execution will become faster, as well.”

Coombs said that Google has been working on ART in secret for two years and I have no reason to think otherwise. In fact, it was just under two years ago — May of 2012 — that the courts decided Google didn’t infringe on Oracle’s Java-related patents. So while ART may have been planned to speed up Android apps, I wouldn’t be surprised to hear that it got started because of the Oracle suit.

Regardless of how it was born, it’s coming to Android at some point. Coombs plans some follow-up thoughts on ART in the coming days and I’m looking forward to hearing more. After all, anything that could bring app speed and efficiency to Android is worth watching out for.

Update: This post was updated at 6:21am PT, Nov. 7 to correct the time frame of the court decision.

  1. I have always been disappointed by Android’s inability to run native code. When you look at the iPhone, with it’s tiny battery and comparatively slow dual-core processor, and then you see it run circles around all but the latest quad-core Snapdragon 800 phones (which run over 1GHz faster than the A7), you can really see just how slow and inefficient Android is. I hope ART can help bridge that gap.

    Share
    1. Umm .. last I checked: http://developer.android.com/tools/sdk/ndk/index.html .. you think all those Android games are coded in Java? heh.

      Share
    2. It’s a shame that performance and battery tests completely disagree with you.

      Share
      1. You mean rigged performance tests and rigged battery tests, which in any case, don’t.

        Share
        1. You have some proof of this? Don’t try to claim every test is rigged because of Samsung.

          Share
  2. I did this on my Nexus 5 and it sent it into a boot loop after rebooting. Looking at logcat, mm-camera keeps crashing. Not sure why it didn’t work properly on mine.

    Share
  3. Hogwash!

    Share
  4. This has nothing to do with the Oracle law suit. Oracle was suing for the use of java APIs. That doesn’t change at all with ART. They have got nothing on dalvik.

    Share
  5. You can use C++ or even asm code in Android using NDK for ages. In fact my Android apps do not use Dalvik or Java. And yes, most games do take advantage of that.

    Share
  6. If I am not mistaken, “May of 2012″ is not really “over two years ago”.
    Am I mistaken?

    Share
    1. You are not mistaken. I think I had the original court date of 2010 in my head when I wrote that part. Thanks for the note and I’ll make a correction. :)

      Share
  7. If I recall (it’s been a while), byte code is very memory efficient. Won’t compiling at installation time increase storage requirements? Any figures from those who’ve been able to use ART?

    Share
  8. I believe windows phone 8 uses something like this. This is a good move for android apps

    Share
  9. I switched to ART on my Nexus 5 and I now regret it. Before in Antutu I had 29555 after switching to ART I benchmark-ed at 15500 I was disappointed and actually I noticed lag and skips when scrolling webpages on ART so I switched back to Dalvik and now benchmark shows 16200. WTF!!!!

    I will have to do factory reset now.

    So if anyone plans to do it on their nexus I highly NOT recommend it.

    Share
    1. It’s because your CPU is being throttled on the Nexus 5.

      ART is only about how code is interpreted in loading parts of the app, it should not majorly affect the performance inside the app. It won’t change benchmark scores.

      I reccommend you research the word “mpdecision”. You will only be able to take a proper benchmark without it in your kernel.

      The Nexus 5 should bench at about 32000

      Share
  10. I have trable on my Nexus 4, when I choise ART and my phone reboot, than stop on logo and loop any time… where is problem, any idea?

    Share

Comments have been disabled for this post