Appendix A. ART: The Android Runtime

image with no caption

Android apps need to run on devices with low-powered processors and very little memory.

Java apps can take up a lot of memory, and because they run inside their own Java Virtual Machine (JVM), Java apps can take a long time to start when they’re running on low-powered machines. Android deals with this by not using the JVM for its apps. Instead, it uses a very different virtual machine called the Android runtime (ART). In this appendix, we’ll look at how ART gets your Java apps to run well on a small, low-powered device.

What is the Android runtime (ART)?

The Android runtime (ART) is the system that runs your compiled code on an Android device. It first appeared on Android with the release of KitKat and became the standard way of running code in Lollipop.

ART is designed to run your compiled Android apps quickly and efficiently on small, low-powered devices.

ART is very different from the JVM

Java has been around for a very long time, and compiled Java programs have almost always run on Oracle’s Java Virtual Machine (JVM). The JVM simulates a CPU chip, and it reads a compiled .class file that contains JVM machine code instructions called bytecodes. Traditionally you would compile .java source files into .class files. You would then run these using the JVM interpreter.

ART is very different. When you compile an Android application, everything starts in ...

Get Head First Android Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.