Appendix C. Art: The Android Runtime

Ever wonder how Android apps can run on so many kinds of devices? Android apps run in a virtual machine called the Android runtime (ART), not the Oracle Java Virtual Machine (JVM). This means that your apps are quicker to start on small, low-powered devices and run more efficiently. In this appendix, we’ll look at how ART works.

What is the Android runtime?

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. Android Studio uses the Gradle build system to do all the work of creating and installing apps for you, but it can be useful to understand what happens behind the scenes when you click the Run button. Let’s see what really goes on.

Note

You don’t need to understand the info in this appendix in order to create cool Android apps. So if you’re not into the nitty-gritty of what’s going on behind the scenes when an Android device runs an app, feel free to skip this appendix.

Previously, Java code ran on the Oracle JVM

Java has been around for a very long time, and compiled Java applications have almost always been run on the Oracle Java Virtual Machine (JVM). In that scenario, Java source code gets compiled ...

Get Head First Android Development, 2nd Edition 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.