Fact-checked by Grok 2 weeks ago

Android Runtime

The Android Runtime (ART) is a managed environment that executes Dalvik Executable (DEX) for applications and certain system services on devices running 5.0 (API level 21) and later. It replaced the Dalvik virtual machine, which relied on just-in-time () compilation, by introducing ahead-of-time (AOT) compilation that converts app into native during installation, thereby enhancing startup times, performance, and battery efficiency. Each app operates within its own process, supported by a dedicated ART instance that leverages the underlying for process isolation, threading, and low-level memory management. Originally developed as part of the Open Source Project, evolved from Dalvik to address limitations in performance and scalability as Android devices grew more powerful. Introduced experimentally in Android 4.4 (KitKat) and made the default in Android 5.0 (Lollipop), maintains backward compatibility with Dalvik bytecode, allowing apps optimized for one to generally run on the other, though -exclusive features require higher API levels. Key advancements include a hybrid model combining AOT for initial optimization with for adaptations, using profile-guided to refine code based on usage patterns and reduce overhead during app updates. ART's design emphasizes efficient garbage collection with a mostly concurrent, compacting collector that minimizes pause times and heap fragmentation, achieving up to 32% smaller heap sizes and 70% faster allocations compared to Android 7.0 in Android 8.0. Subsequent updates, such as those in Android 8.0 (Oreo), introduced loop optimizations like bounds check elimination and SIMD instructions, class hierarchy analysis for better inlining, and faster native interfaces via annotations like @FastNative and @CriticalNative. Further enhancements in later versions, including the introduction of ART Service in Android 14 for modular updates and the Generational Concurrent Mark-Compact Garbage Collector in Android 16 QPR2 (as of October 2025), continue to improve performance, reduce jank, and facilitate debugging with tools such as sampling profilers and detailed exception reporting.

Overview

Definition and Role

The Runtime (ART) is a managed environment that executes Android applications and certain system services by processing Dalvik Executable (DEX) . It serves as the core execution engine for apps developed primarily in or Kotlin, which compile to DEX compatible with Android's ecosystem. ART's primary role is to translate this platform-agnostic DEX into native tailored for the device's , enabling efficient execution on hardware such as and x86 architectures. This conversion process ensures that Android applications run with optimized performance directly on the underlying hardware, bridging the gap between high-level application code and low-level system resources. Within the Android operating system's layered architecture, occupies a central position between the —which provides higher-level APIs for developers—and the , which handles core system operations like and process management. became the default runtime starting with Android 5.0 in 2014, succeeding the earlier Dalvik virtual machine to deliver enhanced runtime capabilities across the platform.

Key Components

The Android Runtime (ART) consists of several core modular components that enable the execution of Android applications. Central to ART is the , known as libart.so, which provides the foundational services for loading, verifying, and executing compiled code during app . This library is loaded into the Android system at boot time and handles essential operations such as garbage collection, thread management, and . A key element in ART's compilation pipeline is the ahead-of-time (AOT) compiler, dex2oat, which converts Dalvik Executable (DEX) into native optimized for the device's architecture. Dex2oat performs this transformation at install time or during background optimization, ensuring that applications start faster by avoiding initial overhead. Integrated within dex2oat is the DEX file format verifier, which conducts rigorous checks on the to ensure , resource access compliance, and overall integrity before compilation proceeds, thereby preventing errors and enhancing . ART also relies on the process, which serves as the parent process for all application processes. Zygote preloads common framework classes and resources into memory at system startup, allowing new app processes to be efficiently forked from it with minimal overhead, thus improving launch times and resource sharing across applications. The output of dex2oat is stored in the file format, a container that holds the compiled native code alongside the original DEX data for quick loading and execution. Oat files enable ART to map executable code directly into process memory, supporting both AOT and hybrid modes without requiring on-the-fly interpretation. Additionally, ART incorporates profile-guided , which leverages usage data collected from application execution to inform optimization decisions. This mechanism allows dex2oat to prioritize frequently used code paths for AOT , dynamically refining performance based on real-world app behavior while balancing storage and battery constraints.

History

Origins and Development

The (ART) originated as part of the Open Source Project (), developed by specifically for the platform as a successor to the Dalvik virtual machine. Dalvik, the original , relied on just-in-time () , which introduced overhead that affected app startup times and battery efficiency on resource-constrained mobile devices. ART was motivated by these limitations, aiming to deliver faster application launch speeds and reduced power consumption through a shift toward ahead-of-time (AOT) strategies. Experimental development of began in the early , with initial prototypes emphasizing AOT techniques to mitigate Dalvik's drawbacks, such as the overhead of on-device interpretation and compilation during app execution. By 2013, had advanced these efforts sufficiently to integrate an experimental version of into Android 4.4 KitKat, where it was made available as a developer option for testing improved and garbage collection efficiency. This preview release marked a significant step in addressing Dalvik's challenges, including its resource-intensive garbage collection that could lead to stutters and higher battery drain. At 2014, formally highlighted as a performance-focused evolution of the Android runtime, announcing its adoption as the default in the upcoming Android 5.0 release. This event underscored ART's role in enhancing overall system responsiveness and energy efficiency, building on the experimental groundwork from KitKat. The development timeline reflected 's multi-year investment in refining the runtime within , prioritizing compatibility with existing Dalvik bytecode while introducing optimizations for modern hardware.

Introduction and Adoption

The Runtime (ART) was introduced experimentally in Android 4.4 KitKat in 2013 as an optional alternative to the Dalvik virtual machine, allowing users to select it via developer options for testing ahead-of-time (AOT) compilation benefits. ART became the default runtime in Android 5.0 in 2014, replacing Dalvik's just-in-time () approach with AOT compilation to enhance app startup times and overall efficiency, while introducing support for 64-bit architectures on , x86, and hardware. Dalvik bytecode compatibility was retained, allowing existing apps to run on ART. By 7.0 in 2016, evolved into a hybrid AOT/JIT system for optimized performance, with Dalvik fully phased out. The transition generated OAT files—pre-compiled native executables from DEX bytecode—resulting in larger installed app sizes due to on-device compilation during installation. By in 2019, supported concurrent compilation using Google Play profiles to pre-compile code paths, reducing install times without blocking the . In (2021), became a mainline module, enabling independent updates via system updates for delivering optimizations, features, and security fixes without full OS upgrades. Subsequent updates, such as those in (2022), improved app startup times by up to 30% on some devices. As of (released June 2025), includes further performance enhancements and support for modern hardware.

Technical Architecture

Compilation Mechanisms

The Android Runtime (ART) primarily employs ahead-of-time (AOT) compilation to convert Dalvik Executable (DEX) bytecode into native machine code, enhancing app performance by avoiding runtime interpretation. This process occurs at install time using the dex2oat tool, which takes DEX files from an as input and generates optimized native executables in format. The compilation pipeline begins with DEX , which applies stricter checks than previous to ensure validity, rejecting issues like invalid or unbalanced monitor operations. Verified then undergoes optimization, including inlining, , and architecture-specific code generation, before outputting an file containing ELF-based native code, along with metadata in VDEX and optional ART startup data. This install-time conversion reduces startup latency and improves execution speed for standard Java/Kotlin code. To balance compilation speed with performance, ART incorporates hybrid modes, notably the speed- filter introduced in later versions. In this mode, dex2oat performs full DEX verification and AOT-compiles only methods identified in a (initially derived from ), while optimizing loading for profiled to accelerate installs without full AOT coverage. During , apps collect local on methods, which a background daemon uses to recompile the app opportunistically when the device is idle and charging, refining the profile for subsequent optimizations. Although AOT forms the core of ART's approach, just-in-time (JIT) compilation elements are retained as a secondary mechanism for dynamic optimizations on infrequently executed or profile-emergent code paths. The JIT compiler, activated since Android 7.0, profiles running methods and compiles hot ones into native code using runtime-specific information like type feedback, complementing AOT by filling gaps in precompiled binaries without requiring full recompilation. This hybrid setup ensures ongoing performance gains while minimizing storage overhead from exhaustive AOT.

Runtime Environment

The Android Runtime (ART) manages the execution environment by loading Optimized Ahead-of-Time (OAT) files into memory upon application startup, where these files contain machine code derived from Dalvik Executable (DEX) bytecode. This process begins when an app is launched, triggering ART to map the OAT file directly into the process's address space, avoiding the need for on-the-fly interpretation or compilation if the OAT is present. Class loading occurs through the class linker component, which resolves and initializes classes from the loaded OAT or DEX, linking them into the runtime's object model while verifying type safety and dependencies. Method invocation then proceeds via direct calls to the native machine code embedded in the OAT, enabling efficient execution without bytecode interpretation for compiled portions. Process management in ART relies on the system process, which serves as the parent for all Android application processes to ensure efficient launching and resource sharing. Spawned early during system boot by the daemon, Zygote preloads common system libraries, classes, and resources—such as core libraries and Android framework components—into its own memory space, reducing startup overhead for child processes. When an app is requested, Zygote forks a new process (or draws from an unspecialized app process pool if enabled), inheriting the preloaded elements and specializing them for the specific application via a for configuration like process IDs and . This fork-based model minimizes memory duplication and accelerates app initialization, particularly on devices supporting multiple ABIs. Since , has been integrated as a Project Mainline module, enabling it to receive over-the-air updates through System Updates. This allows for independent delivery of performance improvements, bug fixes, and security enhancements to the runtime environment on devices running (API level 31) and later, without requiring a full operating system update. ART supports execution across multiple instruction sets, including and x86_64, with architecture-specific optimizations integrated into the generation and loading process. The compiler produces files tailored to the target , incorporating optimizations like instruction selection and suited to ARM64's or x86_64's extensions, ensuring compatibility and performance on diverse hardware. For instance, 64-bit compilation can be enabled via properties like dalvik.vm.dex2oat64.enabled on supported devices, allowing to leverage architecture-native features during execution. To accelerate method dispatch, ART employs inline caching, which captures runtime type information at call sites and embeds it into profiles for subsequent optimizations. Introduced in Android 8.0, this mechanism records frequent receiver types during execution, enabling the compiler to devirtualize calls—replacing dynamic lookups with direct native invocations—and store the cache directly in files for reuse across app sessions. By integrating with analysis, inline caching reduces dispatch overhead, particularly for polymorphic methods, without requiring full recompilation.

Features and Optimizations

Performance Enhancements

The (ART) delivers key performance enhancements primarily through its ahead-of-time (AOT) compilation process, which converts application to native during installation rather than at . This shift from Dalvik's just-in-time () approach results in substantially reduced app launch times, with reports indicating improvements of up to 30% faster startups on certain devices following ART optimizations. Additionally, AOT minimizes CPU overhead by eliminating much of the on-the-fly compilation required in Dalvik, leading to lower overall CPU usage and smoother app execution. A significant optimization in ART is profile-guided compilation, introduced starting with Android 7.0 (Nougat), which leverages runtime profiles generated from actual app usage to inform targeted AOT and recompilations. These profiles identify "hot" methods and code paths, allowing ART to prioritize optimizations for frequently executed sections, thereby improving efficiency without unnecessary compilation of cold code. ART further enhances by incorporating concurrent garbage collection (), which performs marking and compaction alongside application threads to minimize interruptions in the UI. This concurrent copying collector reduces GC-induced pause times, helping to prevent stuttering during interactive operations; for instance, enhancements in Android 8.0 achieved up to 85% smaller pause durations compared to prior versions. Android 16 includes updates to ART that improve performance and support additional Java features.

Memory Management

The Android Runtime (ART) employs a sophisticated garbage collection system designed to manage memory efficiently in resource-constrained mobile environments. The primary garbage collector is a concurrent design that minimizes application pauses, with the default mode since Android 8.0 being Concurrent Copying (CC), which performs most work concurrently except for a brief initial pause. An alternative mode, Concurrent Mark-Sweep (CMS), traces live objects concurrently and sweeps freed space, but it compacts the heap less frequently to avoid latency. Both modes support partial collections, such as young-generation GCs, which target recently allocated objects for quick, low-latency reclamation without full heap scans, helping maintain smooth UI responsiveness. ART's garbage collection incorporates incremental techniques to distribute workload over multiple cycles, spreading marking and sweeping across application frames to minimize stutter or jank during user interactions. In CC mode, this includes generational collection—introduced in —where young objects are collected more frequently in small increments, while full-heap collections occur only when necessary, ensuring pauses remain independent of overall heap size. These strategies prioritize low-latency operations, with average pause times around 1.83 ms in typical workloads. Advancements in (released in 2022) introduced a userfaultfd-based Concurrent Mark-Compact () garbage collector, leveraging the kernel's userfaultfd to handle page faults during compaction more efficiently, thereby reducing memory pressure, battery consumption, and the risk of low-memory kills for apps. This builds on prior hybrid GC modes, where dynamically selects between , , and partial variants based on workload and device conditions to balance throughput and latency. For instance, mode enables concurrent compaction on every GC run, reducing fragmentation and enabling faster thread-local allocations via bump pointers. In 16 QPR2 (released November 2025), introduced a Generational Concurrent Mark-Compact () garbage collector that focuses collection efforts on recently allocated objects, further reducing pause times and improving memory efficiency. To support large-scale applications, implements adaptive sizing that grows the incrementally during full GCs when allocation throughput falls below a , preventing frequent collections while capping growth to available system memory. Compaction strategies in mode relocate objects concurrently using read barriers, achieving up to 32% smaller average sizes compared to non-compacting predecessors, which is particularly beneficial for handling fragmented memory in long-running apps. Since 5.0, 's full support for 64-bit addressing allows heaps exceeding 2 on compatible devices, accommodating complex applications with extensive object graphs without exhaustion.

Compatibility and Impact

Backward Compatibility

The Android Runtime (ART) ensures backward compatibility with applications developed for the earlier Dalvik virtual machine by executing the same Dalvik Executable (DEX) bytecode format, allowing apps to run seamlessly following the transition from Dalvik in Android 4.4 KitKat. This compatibility is maintained through on-device translation mechanisms, where ART's dex2oat converts DEX from APKs into optimized Ahead-of-Time (AOT) native code files () during installation, avoiding the need for Just-In-Time () interpretation used in Dalvik. Additionally, ART natively supports multi-DEX configurations for apps exceeding the 65,536-method limit, enabling the loading of multiple DEX files from a single without requiring the pre-ART multidex support library on devices running level 21 or higher. Handling API level differences presents challenges for legacy apps, particularly those targeting older versions, as enforces stricter behaviors compared to Dalvik. 's bytecode verifier, integrated into the dex2oat , performs rigorous at install time to ensure compliance with updated and standards, rejecting invalid or obfuscated code that might have passed in Dalvik—such as unbalanced monitor operations or invalid control flows. From 8.0 ( 26), the verifier incorporates enhanced strict mode compliance through features like Class Hierarchy Analysis () and compiled code deoptimization, which dynamically invalidate and reoptimize methods if conditions change, thereby maintaining correctness for apps built against varying levels without breaking legacy functionality. In 16, the Compatibility Definition Document strongly recommends that handheld devices with 2 to 4 GB of support only 32-bit userspace (both apps and code) to optimize usage, while devices with more must support 64-bit ABIs but maintain compatibility for legacy 32-bit applications through standard mechanisms. 16 introduces updates including support for 16 KB page sizes with a to ensure seamless operation of apps built for 4 KB pages, along with performance enhancements like reduced garbage collection overhead, improving compatibility and efficiency for legacy and new applications on diverse hardware. As of QPR2 in September 2025, the Generational Concurrent Mark-Compact garbage collector further minimizes pause times, benefiting battery life and multitasking. To further optimize legacy apps without requiring full recompilation by developers, ART employs profile-guided installation schemes, including baseline profiles and cloud-optimized profiles, which identify and precompile frequently executed code paths during app installation based on runtime usage data. These schemes enable partial AOT compilation focused on "hot" methods, reducing startup times and improving efficiency for older DEX-based apps while preserving their original bytecode integrity.

Influence on Android Ecosystem

The shift to ahead-of-time (AOT) compilation in the Runtime (ART) has encouraged developers to adopt more efficient practices, as the pre-installation process limits optimizations and rewards upfront identification of performance-critical paths. This transition promotes techniques like , where developers analyze and annotate code to direct ART's compiler toward frequently executed methods, reducing app startup latency by up to 30% in optimized scenarios. Android Studio enhances this workflow by integrating ART-specific profiling tools, such as the built-in Android Profiler and Baseline Profile generator, which capture data to inform AOT decisions and streamline of and CPU usage. These features empower developers to iteratively refine applications for ART's environment, fostering a culture of performance-aware development across the Android app ecosystem. At the device level, ART's optimizations, including concurrent garbage collection and reduced interpretation overhead, have extended battery life by minimizing background and fragmentation, while enabling smoother multitasking on low-end with limited and processing . For instance, the improved garbage collection lowers total pause times and allocation events, allowing devices to handle multiple apps more fluidly without excessive draw. ART's modular architecture within the Project () permits original equipment manufacturers (OEMs) to tailor the for specific hardware needs, influencing the broader ecosystem through customized implementations in custom ROMs like . This flexibility has enabled community-driven distributions to incorporate ART variants optimized for stability and features beyond stock . ART further bolsters Android's scalability by providing an efficient, adaptable that underpins variants for resource-limited environments, such as wearables via and deployments, ensuring consistent execution across a wide range of constraints.

References

  1. [1]
    Android runtime and Dalvik - Android Open Source Project
    Aug 26, 2024 · Android runtime (ART) is the managed runtime used by apps and some system services on Android. ART and its predecessor Dalvik were ...ART features · Improved garbage collection · Development and debugging...
  2. [2]
    Platform architecture | Android Developers
    May 20, 2024 · The Android platform includes the Linux kernel, Hardware Abstraction Layer (HAL), Android runtime, Native C/C++ libraries, Java API framework, ...
  3. [3]
    Implement ART just-in-time compiler - Android Open Source Project
    Oct 9, 2025 · Android runtime (ART) includes a just-in-time (JIT) compiler with code profiling that continually improves the performance of Android applications as they run.
  4. [4]
    Android 8.0 ART improvements | Android Open Source Project
    Oct 9, 2025 · The Android runtime (ART) has been improved significantly in the Android 8.0 release. The list below summarizes enhancements device manufacturers can expect in ...
  5. [5]
    The secret to Android's improved memory on 1B+ Devices
    Nov 13, 2023 · The Android Runtime (ART) executes Dalvik bytecode produced from apps and system services written in the Java or Kotlin languages.
  6. [6]
    Android Lollipop | Android Developers
    May 20, 2024 · Android 5.0 provides a faster, smoother and more powerful computing experience. Android now runs exclusively on the new ART runtime, built ...
  7. [7]
    Architecture overview - Android Open Source Project
    A Java runtime environment provided by AOSP. ART performs the translation of the app's bytecode into processor-specific instructions that are executed by the ...
  8. [8]
    Configure ART - Android Open Source Project
    Oct 9, 2025 · This page discusses how to configure Android runtime (ART) and its compilation options. Topics addressed here include configuration of precompilation of the ...
  9. [9]
    Verifying app behavior on the Android runtime (ART) | App quality
    May 9, 2023 · ART uses compacting GC, stricter JNI, and a unified stack. Avoid techniques incompatible with compacting GC, and use CheckJNI for JNI issues. ...Missing: key | Show results with:key
  10. [10]
    About the Zygote processes | Android Open Source Project
    Oct 9, 2025 · The Zygote is a process in the Android operating system that acts as the root of all system and app processes with the same application binary interface (ABI).
  11. [11]
    ART Service configuration | Android Open Source Project
    Oct 9, 2025 · ART Service is a part of the ART module, and you can customize it through system properties and APIs.
  12. [12]
    Android 10 for Developers
    ART profiles delivered by Google Play let ART pre-compile parts of your app even before it's run. At runtime, Android 10 adds Generational Garbage Collection to ...Privacy For Users · Camera And Media · Android Foundations
  13. [13]
    Google Improves Android App Startup Times by up to 30%
    Aug 22, 2023 · The update "delivered real-world app start-up improvements of up to 30% on some devices." Starting with Android 12, Google was able to make ART ...Missing: percentage | Show results with:percentage
  14. [14]
    Android 7.0 for Developers
    May 20, 2024 · Profile-guided compilation lets ART manage the AOT/JIT compilation for each app according to its actual usage, as well as conditions on the ...
  15. [15]
    Android 16 features and changes list - Android Developers
    Android 16 includes the latest updates to the Android Runtime (ART) that improve the Android Runtime's (ART's) performance and provide support for additional ...
  16. [16]
    Debug ART garbage collection - Android Open Source Project
    Aug 26, 2024 · This page describes how to debug Android Runtime (ART) garbage collection (GC) correctness and performance issues.Gc Verification And... · Performance · Use Sigquit To Get Gc...
  17. [17]
    Android 13 is in AOSP! - Android Developers Blog
    Aug 15, 2022 · Overall, the new garbage collector helps to save battery, avoid jank during GC operations, and protect apps from low-memory kills. Optimizations ...
  18. [18]
    Android 16 Compatibility Definition
    This document enumerates the requirements that must be met in order for devices to be compatible with Android 16.
  19. [19]
    Improving app performance with ART optimizing profiles in the cloud
    Apr 1, 2019 · The feature builds on previous Profile Guided Optimization (PGO) work, which was introduced in Android 7.0 Nougat. PGO allows the Android ...
  20. [20]
    Baseline Profiles overview | App quality - Android Developers
    By shipping a Baseline Profile in an app or library, Android Runtime (ART) can optimize specified code paths through Ahead-of-Time (AOT) compilation ...Get Started · Minimum Recommended Stable... · Compilation Behavior Across...Missing: key components<|control11|><|separator|>
  21. [21]
    Profile your app performance | Android Studio
    Oct 29, 2024 · Fixing performance problems involves profiling your app, or identifying areas in which your app makes inefficient use of resources such as the CPU, memory, ...Inspect your app live · Record a system trace · Capture a heap dump
  22. [22]
    Android Runtime (ART) - Android Open Source Project
    Oct 9, 2025 · The ART module aims to improve the Android experience by offering users the latest managed runtime optimizations, features, and bug fixes. Users ...