[MOD][DEV][HOW-TO] Enable Android Runtime (ART)

Search This thread

Hero

Inactive Recognized Developer
Oct 15, 2010
1,397
5,129
Hidden Hills
Here it is guys, the how-to for enabling ART on the new 4.04.1540.2 (Android 4.4) base! I have tested whether ART works and sadly, I get bootloops when using it (both ART and ART (debug). ART (debug) seems to not stick since the phone does boot up, but the selection still shows as "Dalvik" not "ART (debug)". I only tested this on my deodexed ROM so I have no idea if it will work on ODEXED. Hopefully we can get more devs collaborating to get this working. Anyway, enabling ART in the Developer Preferences is really easy.

PART 1
  1. Decompile Settings.apk
  2. Navigate to smali.com.android.settings
  3. Open up DevelopmentSettings.smali in Notepad++ or a text editor of your choice
  4. Locate the followiing code (onCreate() method) and delete the part in RED

    Code:
        const-string v3, "show_touches"
    
        invoke-direct {p0, v3}, Lcom/android/settings/DevelopmentSettings;->findAndInitCheckboxPref(Ljava/lang/String;)Lcom/htc/preference/HtcCheckBoxPreference;
    
        move-result-object v3
    
        iput-object v3, p0, Lcom/android/settings/DevelopmentSettings;->mShowTouches:Lcom/htc/preference/HtcCheckBoxPreference;
    
        const-string v3, "wifi_display_certification"
    
        invoke-direct {p0, v3}, Lcom/android/settings/DevelopmentSettings;->findAndInitCheckboxPref(Ljava/lang/String;)Lcom/htc/preference/HtcCheckBoxPreference;
    
        move-result-object v3
    
        iput-object v3, p0, Lcom/android/settings/DevelopmentSettings;->mWifiDisplayCertification:Lcom/htc/preference/HtcCheckBoxPreference;
    
        const-string v3, "select_runtime"
    
        invoke-virtual {p0, v3}, Lcom/htc/preference/HtcPreferenceFragment;->findPreference(Ljava/lang/CharSequence;)Lcom/htc/preference/HtcPreference;
    
        move-result-object v2
    
       [COLOR="red"] if-eqz v2, :cond_5
    
        iget-object v3, p0, Lcom/android/settings/DevelopmentSettings;->mAllPrefs:Ljava/util/ArrayList;
    
        invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    
        invoke-direct {p0, v2}, Lcom/android/settings/DevelopmentSettings;->removePreferenceForProduction(Lcom/htc/preference/HtcPreference;)Z
    
        move-result v3
    
        if-nez v3, :cond_5
    
        invoke-virtual {p0, v2}, Lcom/android/settings/DevelopmentSettings;->filterRuntimeOptions(Lcom/htc/preference/HtcPreference;)V[/COLOR]
    
        :cond_5
        const-string v3, "hdcp_checking"
  5. Recompile Settings.apk and push it to your device!

    In case you don't know how to enable Developer Preferences in Settings, go to Settings -> About -> Software Information -> More. Once at the "More" screen, tap the Build Number option seven (7) times.

Here are some screenshots :)

1fmj.png
ngc5.png


Here's a flashable zip too: http://d-h.st/B22

Cheers
 

Dunc001

Inactive Recognized Developer
Apr 6, 2010
2,705
1,462
Hiding out south of the border...
As far as I know from running 4.4 ROMs on my Nexus 7 you can only use ART on a fully odexed ROM, deodex will always result in failure to boot. Also some apps are not compatible with ART yet so you may well find a few specific app FCs. It may be that sense apps don't play well with ART yet. Remember it is still a developer only option and not mainstream yet so not really too much of a surprise...
 
Last edited:

gunswordx

Senior Member
Jan 29, 2012
391
91
I did it yesterday and it just stuck at boot animation(animation is complete). I am on stock odexed system.
yes tried on 3 different roms both odexed and deodexed not working on both. i think we need some core files for art to work which htc didn't put in as art is still in testing mode
 

baadnewz

Recognized Developer
Sep 2, 2008
14,340
34,069
39
Bucharest
insertcoin-roms.org
tried it myself at first after setting from shell, and secondly after @jerrylzy gave me his classes dex and pointed out the obvious

anyway in both cases bootloop . on odexed and deodexed as well . logcat doesn't tell me too much yet. still poking. i know for sure that if you have xposed installed ART won't stick after reboot
 
  • Like
Reactions: jerrylzy

Rad ryan

Senior Member
Jan 22, 2011
502
239
How to Enable ART on any Stock or AOSP ROM

Simplest way to enable ART on an AOSP ROM is through “Developer options > select runtime”. But sadly, the option is not even available in most stock ROMs may it be HTC, Samsung, Sony, LG, Motorola etc. The work around is following the steps mentioned below:

Pre-requisites:
1. Rooted 4.4.x ROM (Stock or Custom) with some custom recovery (CWM or TWRP)
2. Xposed framework is not compatible with ART runtime. You must uninstall Xposed framework before continuing.
3. To Check If You Are Using ART Or Dalvik, goto
Open data/property/persist.sys.dalvik.vm.lib in Text Editor, if it shows ‘libart.so’, you’re already on ART, else it would say ‘libdvm.so’.
4. Full list of apps that don’t work with ART.
Note: If libart.so and libart-compiler.so is Not Present in lib folder. Your ROM Doesn’t Support ART.

Step 1. Download Enable ART, Enable Dalvik flashable Zips from xda thread= http://xdaforums.com/showthread.php?t=2707841 .

Step 2. Flash the Enable ART zip in recovery and clear Dalvik cache.

Reboot, *your ROM would boot and create ART cache for the first boot.

Troubleshooting: If you’ve any bootloops or problems, you can revert the change at anytime by flashing enable dalvik zip.

This is just cut and paste from the article linked to in above post

Good Luck :)

Also, does anyone know what the base 4.04.1540.2 that hero mentioned in the op is? Seems like an US Dev base bc of numbering but I haven't heard of this yet.

Sent from my HTC One using Tapatalk
 
Last edited:

gallardo5

Senior Member
Apr 8, 2011
1,023
274
Glasgow
As far as I know from running 4.4 ROMs on my Nexus 7 you can only use ART on a fully odexed ROM, deodex will always result in failure to boot. Also some apps are not compatible with ART yet so you may well find a few specific app FCs. It may be that sense apps don't play well with ART yet. Remember it is still a developer only option and not mainstream yet so not really too much of a surprise...

I was running ART on my nexus4 and Xperia z1 with CM deodexed, so i dont think that's the problem

Sent from my HTC One using XDA Premium 4 mobile app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    Here it is guys, the how-to for enabling ART on the new 4.04.1540.2 (Android 4.4) base! I have tested whether ART works and sadly, I get bootloops when using it (both ART and ART (debug). ART (debug) seems to not stick since the phone does boot up, but the selection still shows as "Dalvik" not "ART (debug)". I only tested this on my deodexed ROM so I have no idea if it will work on ODEXED. Hopefully we can get more devs collaborating to get this working. Anyway, enabling ART in the Developer Preferences is really easy.

    PART 1
    1. Decompile Settings.apk
    2. Navigate to smali.com.android.settings
    3. Open up DevelopmentSettings.smali in Notepad++ or a text editor of your choice
    4. Locate the followiing code (onCreate() method) and delete the part in RED

      Code:
          const-string v3, "show_touches"
      
          invoke-direct {p0, v3}, Lcom/android/settings/DevelopmentSettings;->findAndInitCheckboxPref(Ljava/lang/String;)Lcom/htc/preference/HtcCheckBoxPreference;
      
          move-result-object v3
      
          iput-object v3, p0, Lcom/android/settings/DevelopmentSettings;->mShowTouches:Lcom/htc/preference/HtcCheckBoxPreference;
      
          const-string v3, "wifi_display_certification"
      
          invoke-direct {p0, v3}, Lcom/android/settings/DevelopmentSettings;->findAndInitCheckboxPref(Ljava/lang/String;)Lcom/htc/preference/HtcCheckBoxPreference;
      
          move-result-object v3
      
          iput-object v3, p0, Lcom/android/settings/DevelopmentSettings;->mWifiDisplayCertification:Lcom/htc/preference/HtcCheckBoxPreference;
      
          const-string v3, "select_runtime"
      
          invoke-virtual {p0, v3}, Lcom/htc/preference/HtcPreferenceFragment;->findPreference(Ljava/lang/CharSequence;)Lcom/htc/preference/HtcPreference;
      
          move-result-object v2
      
         [COLOR="red"] if-eqz v2, :cond_5
      
          iget-object v3, p0, Lcom/android/settings/DevelopmentSettings;->mAllPrefs:Ljava/util/ArrayList;
      
          invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
      
          invoke-direct {p0, v2}, Lcom/android/settings/DevelopmentSettings;->removePreferenceForProduction(Lcom/htc/preference/HtcPreference;)Z
      
          move-result v3
      
          if-nez v3, :cond_5
      
          invoke-virtual {p0, v2}, Lcom/android/settings/DevelopmentSettings;->filterRuntimeOptions(Lcom/htc/preference/HtcPreference;)V[/COLOR]
      
          :cond_5
          const-string v3, "hdcp_checking"
    5. Recompile Settings.apk and push it to your device!

      In case you don't know how to enable Developer Preferences in Settings, go to Settings -> About -> Software Information -> More. Once at the "More" screen, tap the Build Number option seven (7) times.

    Here are some screenshots :)

    1fmj.png
    ngc5.png


    Here's a flashable zip too: http://d-h.st/B22

    Cheers
    2
    As far as I know from running 4.4 ROMs on my Nexus 7 you can only use ART on a fully odexed ROM, deodex will always result in failure to boot. Also some apps are not compatible with ART yet so you may well find a few specific app FCs. It may be that sense apps don't play well with ART yet. Remember it is still a developer only option and not mainstream yet so not really too much of a surprise...
    1
    I did it yesterday and it just stuck at boot animation(animation is complete). I am on stock odexed system.
    1
    yes tried on 3 different roms both odexed and deodexed not working on both. i think we need some core files for art to work which htc didn't put in as art is still in testing mode

    libart.so ...