Tuesday, July 22, 2014

How To Switch from Dalvik to ART Runtime on Nexus 7 2012 (and other devices) MANUALLY?

It's been a while the new ART Runtime has been released for various devices, unfortunately it's not available for all Android devices, even not for devices running the Android KitKat, such as Nexus 7 2012.
But is it possible to switch to ART manually? Yes, it is!
The ART Runtime has been introduced as an experimental feature in Android KitKat. For supported devices, the ART can be enabled in developer settings. Unfortunately, for some reason, Nexus 7 2012 is missing this option, therefore you can't switch to ART Runtime.

Some ROMs such as CyanogenMod, Paranoid Android and many more, have enabled this option for unsupported devices but does that mean you have to run on custom ROM in case you want ART on your device? No!

Here's how do you switch from Dalvik to ART manually:

You'll need:

  • A PC
  • Fully installed ADB drivers for your device (on your PC)
  • A device running Android KitKat
  • libart.so file in /system/lib
To tell system whether you're running ART or Dalvik, there's a file located in /data/property/ called
persist.sys.dalvik.vm.lib (be sure to have it)

This file contains one of two possible values:  libdvm.so and libart.so
As you can tell, the libart.so is for ART runtime, the other one for Dalvik.

We can easily change the runtime by replacing the value of this file.


How do we do that? Well, we can either use echo to replace the values directly, or we can pull the file, replace the values and then push the back:


Echo method:

  • Check adb devices for connected devices, ensure USB debugging is ON.
  • Enter the shell using adb shell command.
  • Grant superuser permisisions by typing su
  • Type the following command:  echo libart.so >/data/property/persist.sys.dalvik.vm.lib
  • Exit.
Reboot your deviec to take effect.


ADB push & pull method:

  • Again, check for devices using adb devices, USB debugging is ON.
  • Pull the file from your device to your PC using adb pull /data/property/persist.sys.dalvik.vm.lib
  • Open the file and replace the libdvm.so with libart.so
  • Push the file back to your device using: adb push persist.sys.dalvik.vm.lib /data/property/
  • Finally, reboot your device.

Enjoy your faster device!


No comments:

Post a Comment