19
Jun
art thumb

It looks like Google is putting the last nail in Dalvik's coffin, and the new Android Runtime (ART) is about to take the throne. A pair of commits turned up last night in the master branch of the Android Open Source Project (AOSP) repository that spell certain doom for the Android runtime we've known and loved for all these years. The first of the two changes completely wipes the /libdvm (Dalvik Virtual Machine) folder from AOSP, and the second takes care of changing all of the relevant configuration files and startup scripts to call on the ART runtime. Yup, this is the end for Dalvik.

Screen Shot 2014-06-19 at 12.37.15 PM

Note: The line of 'D's on the far left mean: Delete. Bye-bye Dalvik!

Back in January, we had a pretty good indication that ART was set to become the new default runtime with the next version of Android, but there still remained some level of doubt. At the time, there was no reason to believe that the change wouldn't be reverted, or that it wasn't just a shortcut to enable more convenient testing. While these changes could also be easily reverted, there's really no point to publishing them unless the final intent is to completely remove Dalvik entirely. This also clears up the other remaining question: would Dalvik remain an option even after ART became the default runtime. Obviously, the answer is 'No.'

That about wraps it up. This is great news for fans of ART; and for anybody that isn't... Tough luck. For developers, this is as close to a flashing red light as you can get without an official statement from Google. While the next release of ART will probably go further to improve compatibility with existing apps, it's unlikely to clean up every last issue. In other words, if your app isn't already compatible, you should really get on that.

I'll just end this with the comment left by developer Brian Carlstrom upon the deletion of libdvm (explanation):

Dalvik is dead, long live Dalvik!

Thanks to everybody that sent in tips.

via: XDA

Source: AOSP Commit #98553, #98618

Cody Toombs
Cody is a Software Engineer and Writer with a mildly overwhelming obsession with smartphones and the mobile world. If he’s been pulled away from the computer for any length of time, you might find him talking about cocktails and movies, sometimes resulting in the consumption of both.

  • dan

    Cody, is it possible for the next version of Android to be upgraded to linux kernel 3.10 even on current Nexus 5s?

    • nebula

      very unlikely for the nexus 5

  • http://www.droid-life.com/ Steve B

    About f*cking time.

  • spacekobra

    Is anybody on ART with 4.4.3? Is it more compatible than before?

    • http://www.facebook.com/jonathan.danna.733 Jonathan Danna

      I ran it just recently for a month or so on my nexus 4 and nexus 7 FHD. Didn't have any problems, and the only incompatibility I had was with the xposed framework for obvious reasons. Xposed is why I went back to dalvik.

      • Fatal1ty_93_RUS

        Doesn't it automatically switch you over? I know I had ART enabled on Nexus 7 (it is my prime device for testing stuff like modules and such) and when I installed Xposed and rebooted - it automatically switched me over to Dalvik, and obviously the change runtime option is blocked in the dev settings

    • Kenny O

      I've been running ART on my Nexus 5 since I got last November, I have had not had an issue with any app, no issues since 4.4.3 either - not on the N5 or the N7.

      • spacekobra

        It's mostly games I've noticed. Threes and Kingdom rush didn't work on 4.4.2

        • menexus4

          I only had one or two apps that didn't work. Plants vs zombies 1 and cant remember the other. they were uninstalled an never used on my phone again. have been on ART since February.

          • YouNex

            Do you see any difference ?
            Battery life, app launch speed, storage

          • menexus4

            yes I did, its noticeably faster and smoother, but didn't really affect battery life (screen is the big hog on nexus 4). Actually I think the other app i was talking about was updated to support ART - Whatsapp.

        • BetterWithRoot

          I got the 4.4.3 update and am running ART. Threes crashed the first time i opened it, then after that it runs fine. If you have the latest update try it again. it may work for you.

          Nexus 7 '13

          • spacekobra

            Thanks! I might just wait.

      • Tom Harman

        Exact same here, no issues on nexus 5 or nexus 7 (12).

  • Woodrowe Bones

    Is it just me or shouldnt it be "Dalvik is dead! Long live ART!"?

    • http://www.androidpolice.com/author/cody-toombs/ Cody Toombs

      See the explanation link I included, it explains the joke.

      • AtiRage

        From wikipedia:
        "Long live the king!" refers to the heir who immediately succeeds to a throne upon the death of the preceding monarch.

        So it is basically "Long live the (new) king!".
        Which in this case would be ART.

        • Franco Rossel

          Did you check the link with the explanation?

          • gheedsgreed

            Long live ART is the correct usage

          • APOI

            let's all start a Geef (GIF) vs Jif (GIF) type meaningless argument and forget the joke /s

      • jazoom

        I thought it referred to how 4.4 and below will still be used 5 years from now. Would have been better.

    • Fatal1ty_93_RUS

      No, because Dalvik will only disappear in next Android releases, it won't magically get erased on all those several hundred millions of devices still running 4.4 or older

      • campusten

        Ok, if Dalvik isn't "dying", then the entire phrase is irrelevant.

    • Francesco Lorenzet

      in the original they say "king" twice.
      now they say also dalik twice

      • campusten

        In the original, they're referring to two different "kings", the first the king who just died and the second the king who was just taken the throne. Here the two kings are Dalvik, which died, and ART, which has just taken the throne.

        • pfmiller

          Oh FFS, it's just a joke.

          • http://www.androidpolice.com/author/cody-toombs/ Cody Toombs

            ^ This, right here! This!

            People, it's a simple play on an old phrase. I'm sure it wasn't meant to be a critically accurate and deeply thought out portrayal of current and future events. Just let it go.

          • Joris Griffioen

            NO!

          • PhilNelwyn

            "I'm sure it wasn't meant to be a critically accurate and deeply thought out portrayal"

            Oh yeah, that's certain.

          • DrakeTungsten

            Except that the joke was told wrong, as in "dumb as a screen door on a battleship!"

        • Guest

          the word it is the same. THat was the JOKE!!!!

    • Danny Cotton

      It should be "Android's runtime is dead! Long live Android's runtime!"

      It signifies that one is gone and a new one is here without naming them like the kings ("The king" rather than "King Charles").

      • Gus70

        ^Totally agree.

        Also not to mention the explanation link says "The King is dead, long live the Queen" is valid. So Dalvik is dead, long live Dalvik is wrong.

      • Dario · 753 a.C. .

        finally i got that :)

  • Danny Holyoake

    "removed from Android" except people will be using dalvik for at least another three or four years.

    This means nothing to developers, who will still have to test for both.

    • Brad

      if it works in art, should be fine in dalvik, no?

      • Justin W

        Should, but no one is developing apps specifically on ART (development takes place on Dalvik, so devs know their apps work on Dalvik) - once that trend changes to developing on ART, they may no longer care if it work son Dalvik or not (with the millions of devices that will remain on a Dalvik version of Android, that will be their mistake).

        • http://www.androidpolice.com/author/cody-toombs/ Cody Toombs

          It's really no different than developing for older versions of Android. If you're going to support ICS (as most developers still do), then a side effect of that is making sure the app works on Dalvik. The only real mystery point is 4.4, where some developers might want to take the extra step to test both Dalvik and ART.

        • Fatal1ty_93_RUS

          And knowing how Google aboslutely doesn't give a shit about how well the devs support certain things - it'll be an armageddon

      • Just_Some_Nobody

        No. That's not how software works. Nothing that's rewritten can ever be guaranteed to be 100% like the older version.

  • fzammetti

    Ok, so here's my question: 4.4.4, or whatever, hits... I go to install the OTA... what happens if there's not enough storage to do the precomp step? Does the install script fail outright? Or does it somehow leave Dalvik in place? I assume the former, but then, can they switch to ART, do the PRECOMP, run out of space and the revert? Sounds like a recipe for disaster.

    I know from experience running ART chews a not insignificant amount of storage, so even if the update works flawlessly, is Google prepared to deal with unhappy people who see their storage space drop significantly all of a sudden?

    • Carlos Rodríguez

      Maybe the OTA script checks the available space and if you have less than X percent (10 percent or so, IDK) the OTA will fail.

      Like the commit says, libdvm will be deleted, so, there's no way to use dalvik again. So, the update can't be made if you don't have enough space.

      Cheers!

      • fzammetti

        Yeah, exactly... seems like they'd have to do that sort of check first... certainly wouldn't want the update to blow up in the middle of precomp after reboot because there wasn't enough space.

    • http://www.androidpolice.com/author/cody-toombs/ Cody Toombs

      a. The storage consumed by ART vs. Dalvik is trivial on most modern devices. It adds a couple megs to most apps.
      b. You're mixing up the compilation process with the update process.
      c. Updates can't happen if there's not enough space to download/install the update.

      • fzammetti

        "Trivial" is a factor of apps installed... for example, from experience, I can tell you that switching to ART on my S5 chews up very nearly 1Gb of storage... given that I currently have just a tad under 2Gb free, cutting it in half isn't at all "trivial". The only thing you could say is that having 300+ apps installed isn't typical, but that's not a great thing to depend on.

        I'm not mixing them up at all- after an update, at reboot time, the compilation occurs, correct? It sure does when I switch to ART on my S5. So, the precomp step is, from the perspective of the end user, a part of the update.

        As someone else said, the only way I can see this working is if they do an idiot check in the script for free space... and I'd *guess* they'd have to do it based on the number of apps (i.e.: "if (freeSpace < numApps * averageSize) then fail fast" or something like that)... but I'm calling it an idiot check because it's going to be imprecise based on averages... may be the best they can do though.

  • Jaggari

    Xposed!!!

    • Stanley C.

      Yep, I was thinkin... What will happen anyone know details?

      • Tony Ceralva

        The developer has already begun to make it compatible with ART, but he said he would not publish it until ART is stable and default.

        • https://play.google.com/store/apps/developer?id=iWizard Bikram Agarwal

          Oh, he did? That's good to hear. Xposed is indispensable for me now.

          • Tony Ceralva

            Yes, he did, search the FAQ thread in XDA.

  • Death Becomes Me

    Have they just made the switch, or have they also done something to make ART work better?

  • YouNex

    Xposed is dead, long live Xposed !

    • RusticKey

      It will be back.

  • Derek B

    Without Xposed I guess I'll be staying away from AOSP.

  • Stanley C.

    Rovo89 just wroted in XDA:
    "Well, "once" kind of implies that this will happen immediately after Google publishes the "final" version of ART. It should rather be read as "not before" they do so. It's true that I've had a very experimental test build running some months ago. But ART is pretty complex, with lots of different operation modes that need to be tested. I figured it would be a waste of time to do so before ART becomes more stable. The fact that they are still pushing changes every day, including several huge internal refactorings (which will require adjustments in my code) confirms this. I will have to look at it once the official version is available, as then the change rate will hopefully decrease and also because much of it is trial and error. Apart from that, it will also show how other changes (e.g. dual-stack 32/64 bit Zygote, very strict SELinux policy) have an impact on Xposed.

    So keep calm everyone. I'm pretty sure that the will be Xposed for ART (the final version, probably not for KitKat, at least at first), but please don't freak out if it *still* isn't published three days after Google I/O. If it takes a few weeks, then that's what it takes."

    No need to be afraid...

  • Guest

    wow, Dalvik is worth 11k lines of code?

    • Mayoo

      Quantity of line doesn't matter much. It's the quality that matters. Take for example:

      true ? (true ? true : false) : false;
      -----------------------------
      vs
      -----------------------------
      if
      (
      true
      )
      {
      if
      (
      true
      {
      return true;
      }
      else
      {
      return false;
      }
      }
      else
      {
      return false;
      }

      • mgamerz

        One could argue your first line of code isn't that readable anyways.

        • Mayoo

          You just learned one of the most difficult challenge most IT developers face: maintenance/readability vs performance

          • mgamerz

            The compiler will optimize those to the same thing...

            But as an IT/ developer I know what you mean.

          • Just_Some_Nobody

            Except you didn't change the performance. Wanna change the performance, try refactoring to remove the if.. condition. branches can cause a cache dump.

          • Mayoo

            You must be fun at parties. It's an example.

        • Lars Jeppesen

          Especially if the tests are much more complex than "true/false", then it gets really annoying to read.

    • http://www.androidpolice.com/author/cody-toombs/ Cody Toombs

      Strictlly speaking, that's the Dalvik Virtual Machine. The whole of Dalvik, which includes several other components, is much larger. Plenty of things have to remain, at least temporarily. For example, ART reads the dex files from the APK when it does the compilation step during first start-up, and those are formated for Dalvik. Someday, that might change, but in the meantime, there will be some leftovers of the Dalvik era.

  • Rovex

    Good. Ive only had one app that i use regularly not work with ART, and thats due to developer laziness rather than anything else (its a large supermarkets app).

    For me ART makes quite a difference to smoothness. Scrolling widgets are smoother and app opening is faster. I gave up using Xposed because the gains from ART were worth it, plus i felt that Xposed slowed the system down anyway (despite claims that it doesn't).

  • Nathan Fletcher

    Hate to say it, but I don't like the increased space usage that is associated with ART, and therefore I can't support this, especially when phones have no removeable storage

    • Kenton Douglas

      What's the increase (%) in space used?

      • Nathan Fletcher

        I believe it was in the range of 18 percent but on my stock moto x I saw 500 mb more of used space

        • Kenton Douglas

          Woh! that's a lot

    • RickMartensen

      iphone users don't complain too, so I don't see why that's a big deal?!

      • LjL

        Why does what "iPhone users" do or don't do matter?

        • RickMartensen

          Because they do have more native apps (faster) than Android.

  • Harshith Mohan

    As long as I can use all apps and games.. I'm not against it :)

  • Lars Jeppesen

    Great news! I'm psyched!

    It's kinda crazy.. I'm here in Rio de Janeiro, watching the World Cup and hanging out. But I'm mostly looking forward to Google I/O in a weeks time.

    • no-one-cares

      No one likes a humblebrag.

      • Lars Jeppesen

        I'm sorry. It wasn't my intension.

        I wanted to point out how excited I am for I/O, and needed to perspectivate.

  • emjin

    Can't phones run ART and Dalvik side by side?
    could allow some apps run with ART, other with Dalvik.

    • Colin Richardson

      How much of your phones resources are you willing to give to each?
      How much is the next person? How do you explain this to people who do not know what a runtime is? How do you test if someone is giving Dalvik or Art enough resources to run your game/app smoothly. How do you tell someone to change it to make it work nicer?