top of page

Android Architecture - Part 1

  • Writer: Aastha Thakker
    Aastha Thakker
  • 6 days ago
  • 5 min read

Android is the most widely used mobile operating system in the world today, even though, personally, I admire the Apple ecosystem. According to StatCounter Global Stats, Android holds over 71% of the global mobile OS market share, significantly ahead of iOS.


This dominance is driven by its open architecture, availability across diverse price ranges, and a highly adaptable app ecosystem that serves both everyday users and developers.



As a student, I used to find Android development frustrating and honestly didn’t enjoy learning it at first. But over time, as I kept breaking concepts down into simple terms, I slowly started liking it (a little). Since I always write what I learn in an easy way, I decided to put this together so that if you ever get stuck where I once did, it feels less overwhelming. If you’re just starting your Android journey, take this as your sign to begin and stay consistent with it.


What is Android?


Android is an open-source, Linux-based operating system developed by the Open Handset Alliance (a consortium led by Google and including major tech companies such as Samsung, Sony, and Intel). Android has revolutionized mobile computing since its inception. Google released the first Android SDK beta in 2007, followed by the first commercial version, Android 1.0, in September 2008. Since then, the platform has evolved significantly with major releases like Jelly Bean (4.1) in 2012, Lollipop (5.0) in 2014, and continuing updates through Android 15 and beyond. What makes Android particularly appealing to developers is its unified development approach: build once for Android, and your app can run across countless devices. The platform’s source code is freely available under open-source licenses, primarily the Apache License 2.0 for most code and the GNU General Public License v2 for Linux kernel modifications, making it a collaborative and accessible ecosystem for innovation.


What is API Level?


API Level is an integer value that uniquely identifies the framework API revision offered by a specific version of the Android platform. Think of it as Android’s version number for developers, it tells them which features and capabilities are available in a particular Android release.


Each Android version corresponds to a specific API level, which helps developers ensure their apps are compatible with different devices. For example, Android 6.0 (Marshmallow) uses API Level 23, while Android 5.0 (Lollipop) uses API Level 21. When developers build an app, they specify a minimum API level, ensuring their app only runs on devices that support the necessary features.


Why API Fragmentation is Still a Challenge?


API fragmentation remains one of Android’s biggest headaches for developers, even today. Here’s the issue:


The Problem: Unlike iOS where most users quickly update to the latest version, Android users are spread across many different OS versions. Each version supports different API levels with different features. (A device running Android 8.0 (API 26) can’t use features introduced in Android 12 (API 31))


Impact

  • For Developers: You must decide, target the latest features and exclude millions of older devices, or support older versions and miss out on modern capabilities

  • Testing Nightmare: Apps need to be tested across multiple API levels to ensure compatibility

  • Code Complexity: Developers often write conditional code like “if device is API 26+, use this feature; otherwise, use fallback option”


Why It Persists

  • Manufacturers are slow to push updates (especially for budget devices)

  • Older devices physically can’t support newer Android versions

  • Users don’t always update even when updates are available

  • Carriers and OEMs add their own customization layers, delaying updates further


Android Architecture


The Android operating system is built as a carefully organized stack of software components, divided into five main sections across four primary layers.


1. Linux Kernel (Foundation Layer)



At the foundation of Android lies the Linux Kernel. This layer serves as the heart of Android architecture, providing a crucial abstraction between device hardware and software components.


Key responsibilities include:


  • Abstraction between the device hardware and the upper layers.

  • Security: Manages security between applications and the system

  • Memory Management: Efficient allocation and handling of device memory

  • Process Management: Allocates resources to processes as needed

  • Network Stack: Handles all network communication

  • Power Management: Optimizes battery usage and device performance


2. Platform Libraries (Native Libraries Layer)


Built on top of the Linux kernel, this layer contains essential C/C++ and Java-based libraries that provide core functionality:



Key libraries include:

  • Media Library: Support for audio and video playback and recording

  • Surface Manager: Manages display subsystem access

  • OpenGL ES & SGL: 2D and 3D graphics rendering

  • SQLite: Database management for data storage

  • WebKit: Open-source web browser engine for displaying web content

  • SSL: Secure encrypted connections for internet security

  • FreeType: Font rendering support


3. Android Runtime


The Android Runtime is a critical component that enables applications to run efficiently. Originally powered by the Dalvik Virtual Machine (DVM), it has evolved significantly:


Key features:

  • Dalvik VM (legacy): A register-based virtual machine optimized for Android, allowing each app to run in its own process

  • ART (Android Runtime): Starting from Android 5.0, ART replaced Dalvik, using ahead-of-time (AOT) compilation to convert bytecode into native code for better performance

  • Core Libraries: Enable developers to write Android applications using standard Java or Kotlin programming languages


The runtime leverages Linux kernel features like memory management and multi-threading to ensure smooth app execution.


4. Application Framework


The Application Framework provides high-level services in the form of Java classes that developers use to build applications. This layer offers essential tools and APIs that simplify app development.


Key services include:

  • Activity Manager: Controls application lifecycle and activity stack (opening, pausing, closing screens)

  • Content Providers: Enables data sharing between applications (contacts, photos, etc.)

  • Package Manager: Tracks all installed applications on the device

  • Window Manager: Handles window placement and appearance on screen

  • View System: An extensible set of views for creating user interfaces

  • Notification Manager: Displays alerts and notifications to users

  • Resource Manager: Provides access to non-code resources like strings, colors, and layouts


5. Applications (Top Layer)


At the top of the architecture sit the Applications, both pre-installed system apps (Contacts, Camera, Browser, Gallery) and third-party apps downloaded from the Play Store (games, chat apps, productivity tools).

All applications run within the Android Runtime environment, utilizing the classes and services provided by the Application Framework layer. This is where developers install their custom applications and where users interact with their devices daily.


Why ART Improved Performance Compared to Dalvik


Here’s why:


Dalvik’s Approach (Just-In-Time Compilation)


  • Dalvik used JIT (Just-In-Time) compilation, meaning it converted bytecode to native machine code while the app was running

  • Every time you opened an app, Dalvik had to translate parts of the code on-the-fly

  • This caused slower app startup times and consumed more battery during execution


ART’s Solution (Ahead-Of-Time Compilation)


  • ART uses AOT (Ahead-Of-Time) compilation, converting bytecode to native code during app installation

  • When you launch an app, the code is already in machine-readable format, no translation needed

  • Result: Faster app launches, smoother performance, and better battery efficiency


Dalvik was like translating a book while reading it aloud, while ART translates the entire book beforehand so you can just read fluently.


Trade-off: ART apps take slightly longer to install and use more storage space, but the performance gains during actual usage far outweigh these minor drawbacks.


References: 


Android architecture may look complex at first, but once understood, it becomes a clear and powerful system. See you next Thursday with another Android topic.


 
 
 

Comments


bottom of page