ART Explained http://source.android.com/devices/tech/dalvik/art.html
ART Features
Ahead-of-time (AOT) compilation
Improved garbage collection
Development and debugging improvements
Known Issues
Fixed issues
Enabling ART in Android Build
Reporting Problems
See also
Verifying App Behavior on the Android Runtime (ART)
ART is a new Android runtime being introduced experimentally in the 4.4 release. This is a preview of work in progress in KitKat that can be turned on in Settings > developer options. This is available for the purpose of obtaining early developer and partner feedback.
Important: Dalvik must remain the default runtime or you risk breaking your Android implementations and third-party applications.
Most existing apps should just work when running with ART. However, some techniques that work on Dalvik do not work on ART. For information about the most important issues, see Verifying App Behavior on the Android Runtime (ART).
ART Features
Here are some of the major new features implemented by ART.
Ahead-of-time (AOT) compilation
ART introduces ahead-of-time (AOT) compilation, which can improve app performance. ART also has tighter install-time verification than Dalvik.
At install time, ART compiles apps using the on-device dex2oat tool. This utility accepts DEX files as input and generates a compiled app executable for the target device. The utility should be able to compile all valid DEX files without difficulty. However, some post-processing tools produce invalid files that may be tolerated by Dalvik but cannot be compiled by ART. For more information, see Addressing Garbage Collection Issues.
Improved garbage collection
Garbage collection (GC) can impair an app's performance, resulting in choppy display, poor UI responsiveness, and other problems. ART improves garbage collection in several ways:
One GC pause instead of two
Parallelized processing during the remaining GC pause
Collector with lower pause time for the special case of cleaning up recently-allocated, short-lived objects
Improved garbage collection ergonomics, making concurrent garbage collections more timely, which makes GC_FOR_ALLOC events extremely rare in typical use cases
ART currently does not use compacting GC, but this feature is under development in the Android Open Source Project (AOSP). In the meantime, don't perform operations that are incompatible with compacting GC, such as storing pointers to object fields. For more information, see Addressing Garbage Collection Issues.
Development and debugging improvements
ART offers a number of features to improve app development and debugging.
Support for sampling profiler
Historically, developers have used the Traceview tool (designed for tracing application execution) as a profiler. While Traceview gives useful information, its results on Dalvik have been skewed by the per-method-call overhead, and use of the tool noticeably affects run time performance.
ART adds support for a dedicated sampling profiler that does not have these limitations. This gives a more accurate view of app execution without significant slowdown. Sampling support has also been added to Traceview for Dalvik.
Support for more debugging features
ART supports a number of new debugging options, particularly in monitor- and garbage collection-related functionality. For example, you can:
See what locks are held in stack traces, then jump to the thread that holds a lock.
Ask how many live instances there are of a given class, ask to see the instances, and see what references are keeping an object live.
Filter events (like breakpoint) for a specific instance.
See the value returned by a method when it exits (using “method-exit” events).
Set field watchpoint to suspend the execution of a program when a specific field is accessed and/or modified.
Improved diagnostic detail in exceptions and crash reports
ART gives you as much context and detail as possible when runtime exceptions occur. ART provides expanded exception detail for java.lang.ClassCastException, java.lang.ClassNotFoundException, and java.lang.NullPointerException. (Later versions of Dalvik provided expanded exception detail for java.lang.ArrayIndexOutOfBoundsException and java.lang.ArrayStoreException, which now include the size of the array and the out-of-bounds offset, and ART does this as well.)
For example, java.lang.NullPointerException now shows information about what the app was trying to do with the null pointer, such as the field the app was trying to write to, or the method it was trying to call. Here are some typical examples:
java.lang.NullPointerException: Attempt to write to field 'int
android.accessibilityservice.AccessibilityServiceInfo.flags' on a null object
reference
java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String java.lang.Object.toString()' on a null object reference
ART also provides improved context information in app native crash reports, by including both Java and native stack information.
Known Issues
The following known issues are present in the 4.4.1 implementation of ART.
Compile-time issue: As noted above, ART flags unbalanced monitorenter/moniterexit instructions. We relaxed this check in 4.4.1 but intend to restore this verification in the future once tools are fixed, as this check is necessary for certain compiler optimizations. https://code.google.com/p/android/issues/detail?id=61916
Run-time issue: There was an issue where JNI GetFieldID and GetStaticFieldID were using the wrong class loader on unattached threads, often leading to later CheckJNI errors or NoSuchFieldError exceptions. http://code.google.com/p/android/issues/detail?id=63970
Run-time issue: Calling JNI NewDirectByteBuffer() with byte size of 0 led to the following CheckJNI error:
JNI DETECTED ERROR IN APPLICATION: capacity must be
greater than 0: 0
http://code.google.com/p/android/issues/detail?id=63055
Fixed issues
Compile-time issue: Overly aggressive verification and compilation of unused portions of dex files lead to corrupt package messages. This was addressed in AOSP with: https://android-review.googlesource.com/#/c/72374/
Debug-time issue: Interactive debugging performance was slow, even in code without breakpoints. This has been addressed in the latest AOSP code.
Enabling ART in Android Build
Two runtimes are now available, the existing Dalvik runtime (libdvm.so) and the ART runtime (libart.so). A device can be built using either or both runtimes. (You can dual boot from Developer options if both runtimes are installed.) See runtime_common.mk. That is included from build/target/product/runtime_libdvm.mk or build/target/product/runtime_libdvm.mk or both.
The dalvikvm command line tool can run with either runtime now. It will default to using the runtime specified in developer options. The default can be overridden by specifying the desired runtime library, for example with -XXlib:libart.so
A new PRODUCT_RUNTIMES variable controls which runtimes are included in a build. Include it within either build/target/product/core_minimal.mk or build/target/product/core_base.mk.
Add this to the device makefile to have both runtimes built and installed, with Dalvik as the default:
PRODUCT_RUNTIMES := runtime_libdvm_default
PRODUCT_RUNTIMES += runtime_libart
Reporting Problems
If you run into any issues that aren’t due to app JNI issues, please report them via the Android Open Source Project Issue Tracker at https://code.google.com/p/android/issues/list. Please include an "adb bugreport" and link to the app in Google Play store if available. Otherwise, if possible, attach an APK that reproduces the issue. Please note that issues (including attachments) are publicly visible.
Except as noted, this content is licensed under Creative Commons Attribution 2.5. For details and restrictions, see the Content License.
About Android | Community | Legal |
Click to expand...
Click to collapse
Another great post from simms no surprises there lol great detailed explanation thanks.
Sent from my Nexus 5 using XDA Premium 4 mobile app
sharingan92 said:
Another great post from simms no surprises there lol great detailed explanation thanks.
Sent from my Nexus 5 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Dude he is just quoting the developer page for art written by someone at Google, he even used quotation and everything.
It's a good page nevertheless and its nice to have it posted here.
mortenmhp said:
Dude he is just quoting the developer page for art written by someone at Google, he even used quotation and everything.
It's a good page nevertheless and its nice to have it posted here.
Click to expand...
Click to collapse
I never stated it was his own words i was merely stating the fact that once again simms has posted something people would like to read to understand android a little more just like all the information he gives users over on the trinity thread
Sent from my Nexus 5 using XDA Premium 4 mobile app
sharingan92 said:
I never stated it was his own words i was merely stating the fact that once again simms has posted something people would like to read to understand android a little more just like all the information he gives users over on the trinity thread
Sent from my Nexus 5 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I've been using this runtime for several months and I'm very happy! Thanks a lot
So, what's art again? Hahahahaha. Jk. Cool, well done simms. [emoji12]
Sent from my Nexus 5 using Tapatalk
Before I go through the pain of enabling ART, only to have to disable it again, are there any common apps that are known to be incompatible at this point?
Last time when I tried ART, Whatsapp wouldn't run.
Ender666666 said:
Before I go through the pain of enabling ART, only to have to disable it again, are there any common apps that are known to be incompatible at this point?
Last time when I tried ART, Whatsapp wouldn't run.
Click to expand...
Click to collapse
That was 7 months ago!
Sent from my Nexus 5
Good to know how long it's been, but it doesn't fly answer the question... I am wondering if everything is hunky dorry, or if there are any common apps that remain broken. WhatsApp was just a single example.
Sent from my Nexus 5 using Tapatalk
I don't use whatsapp, but I have used ART since a week after the Nexus 5 came out.
I have experienced absolutely zero downsides. Everyone's usage is different, but even 6 months ago many people were saying that ART worked great for them. I would say most even.
Whatsapp is a common app, don't get me wrong...but since literally every other app I have ever loaded on my phone works perfectly...I'm of the opinion that some people "blame" ART.
If even freeware apps that have been written and not touched by the developer for 2 years can run just fine in ART, than whatsapp has no excuse for it not having gotten its ducks in a row. (Maybe it has now, I don't know...like I said, I don't use whatsapp)
Granted, if I picked up your phone and switched it to ART, and lets assume you didn't have any of those apps that for whatever reason didn't work well with ART....
I seriously doubt you would even realize I had switched it.
Cirkustanz said:
I don't use whatsapp, but I have used ART since a week after the Nexus 5 came out.
I have experienced absolutely zero downsides. Everyone's usage is different, but even 6 months ago many people were saying that ART worked great for them. I would say most even.
Whatsapp is a common app, don't get me wrong...but since literally every other app I have ever loaded on my phone works perfectly...I'm of the opinion that some people "blame" ART.
If even freeware apps that have been written and not touched by the developer for 2 years can run just fine in ART, than whatsapp has no excuse for it not having gotten its ducks in a row. (Maybe it has now, I don't know...like I said, I don't use whatsapp)
Granted, if I picked up your phone and switched it to ART, and lets assume you didn't have any of those apps that for whatever reason didn't work well with ART....
I seriously doubt you would even realize I had switched it.
Click to expand...
Click to collapse
i use whatsapp, and it works perfectly fine when i use art. the only app that doesnt work for me on art is pandora.
simms22 said:
i use whatsapp, and it works perfectly fine when i use art. the only app that doesnt work for me on art is pandora.
Click to expand...
Click to collapse
Pandora 5.0+ works on art
sent from my Paranoid Rasta HAMMERHEAD
CRIME INC. said:
Pandora 5.0+ works on art
sent from my Paranoid Rasta HAMMERHEAD
Click to expand...
Click to collapse
yup, so ive heard. not here. i boot up, it force closes on boot, and thats all she wrote.
simms22 said:
yup, so ive heard. not here. i boot up, it force closes on boot, and thats all she wrote.
Click to expand...
Click to collapse
Are you running a modified Pandora apk by chance simms? I've seen that ART does not play well with modified apks.
Sent from my Nexus 5 using Tapatalk
Cirkustanz said:
I don't use whatsapp, but I have used ART since a week after the Nexus 5 came out.
I have experienced absolutely zero downsides. Everyone's usage is different, but even 6 months ago many people were saying that ART worked great for them. I would say most even.
Whatsapp is a common app, don't get me wrong...but since literally every other app I have ever loaded on my phone works perfectly...I'm of the opinion that some people "blame" ART.
If even freeware apps that have been written and not touched by the developer for 2 years can run just fine in ART, than whatsapp has no excuse for it not having gotten its ducks in a row. (Maybe it has now, I don't know...like I said, I don't use whatsapp)
Granted, if I picked up your phone and switched it to ART, and lets assume you didn't have any of those apps that for whatever reason didn't work well with ART....
I seriously doubt you would even realize I had switched it.
Click to expand...
Click to collapse
not really. I guess I feel a difference between Dalvik and ART and it was quite obvious, I must say. I felt like there's something missing when I'm on Dalvik. Especially when I'm using the recent app button. Dalvik is just slower than ART on that.
akash3656 said:
Are you running a modified Pandora apk by chance simms? I've seen that ART does not play well with modified apks.
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
yup :angel:
Not sure if anyone watches baseball at all, but the MLB app will not stream video on ART. Crashes every time. I've had to revert to Dalvik for it to work properly.
The only apps I've had problems with are QuizUp (when it first came out, since fixed), and Google Sound Search (had to disable it...Google Now has the functionality built in now..). Amazingly better battery life.
simms22 said:
yup :angel:
Click to expand...
Click to collapse
Then that's probably why it doesn't work haha. If you bother you could try out the official apk and it might work.
Note: I don't use Pandora myself. Don't think it's available at my region.
Sent from my Nexus 5 using Tapatalk
---------- Post added at 03:41 PM ---------- Previous post was at 03:39 PM ----------
zander21510 said:
The only apps I've had problems with are QuizUp (when it first came out, since fixed), and Google Sound Search (had to disable it...Google Now has the functionality built in now..). Amazingly better battery life.
Click to expand...
Click to collapse
Hmmm. Not saying you're wrong. In my experience, using ART seems to have about the same battery life as dalvik. Or a little worse.
It might be just my setup and personally I don't worry too much about the little extra drain.
Sent from my Nexus 5 using Tapatalk
Well it's official! Just read an article on XDA portal. Google is replacing dalvik with art finally. I guess the changes were added to AOSP for the next OS.
check it out, top story on xda portal right now!