View video tutorial

ANDROID Architecture

ANDROID

Android platform architecture is a software stack created for android devices.

Android platform core components

android-platform-architecture

The Linux Kernel: Linux Kernel is the foundation of the android platform. Everything relies on the Linux kernel for underlying functionality to perform. For example, threading and low-level memory management, providing key security features. Linux Kernel allows device manufacturers to develop hardware drivers for kernel.

Hardware Abstraction Layer: Provides standard interfaces and expose device hardware functionalities to the higher-level API framework. The layer consists of multiple library modules for all of its hardware components like camera, Bluetooth, WIFI, Sensors, Audio etc.

Android Runtime: Android Runtime is a software module written to run multiple virtual machines on low-memory devices by executing DEX files. This is the execution environment for Android applications. To make Android apps run efficiently, it uses Ahead-of-Time (AOT) and Just-in-Time (JIT) compilation methods to manage memory and garbage collection. DEX files are Dalvik Executable format files, a bytecode format designed for android devices which are optimized for minimal memory. Java source code is converted into DEX bytecode using build tools. Using Runtime each app runs in its own process and with its own instance of Runtime.

Native Libraries: Many android core system components and services are built from native code. So they need support for native library written in C and C++. Sometimes an app may need functionality from native library and app can access that support through framework API. Such as 2D/3D graphics rendering (OpenGL ES) support, database support (SQLite), media playback functionality, and web browser engine functionality.

API Framework: A rich set of Java and Kotlin APIs are available that developers use to build apps. Android applications use available features through Application Programming Interface (API). This API are reusable modular system components and services. APIs are the building blocks (View System, UI, buttons, Activities, Services, Content Providers, Layout files etc.) to create Android apps.

Applications: Android has some core apps for some basic tasks like email, SMS, contacts, calendar, internet browsing, and more. Users can use these apps and developers can also use the built-in app functionality in their apps instead of having to create similar functionality written by developers. The application user only needs to launch the already installed app from the developer app.

Development perspective

From a development perspective, Google recommends that a modern app architecture should follow the principle of separation of concerns with three layers.

android-platform-architecture

UI Layer: The UI layer displays application data on the screen to the user and handles user interaction using components such as activities, fragments, and other view elements.

Domain Layer: The domain level contains reusable business logic for the application. Developers organize reusable components to encapsulate objects.

Data Layer: The data layer contains all data related operations. This layer uses repositories, local or remote data sources through the Uniform Data Service API.