Theory
What holds your app up?
FestConnect Mobile will sit at the very top of a tall stack of software, and it leans on every layer below it: the framework that gives it buttons, the runtime that executes its code, the libraries that store its data, and the kernel that talks to the actual chips.
Android's design is a layered stack, four floors, each built on the one beneath. Knowing the floors, and their order, is a guaranteed exam question and the mental map for everything you build.
Theory
A four-storey building
Picture a building. The foundation touches the ground (hardware): that is the Linux kernel. On it sit the utility rooms, water tanks and generators (native libraries and the runtime). Above them, the services floor with reception, notices, and staff you call on (the application framework). And on top, the apartments where tenants live (the apps). Each floor depends on the ones below; none floats on its own.
Theory
The four layers, bottom to top
1. Linux Kernel (bottom): device drivers, memory, process and power management, security. Talks to the hardware.
2. Native Libraries + Android Runtime: C/C++ libraries (SQLite for data, WebKit, OpenGL for graphics) and the runtime (ART, formerly Dalvik VM) that runs your app's compiled code, each app in its own VM.
3. Application Framework: the Java APIs you code against, Activity Manager, Content Providers, Notification Manager, View System, Package Manager.
4. Applications (top): built-in apps and yours, like FestConnect.
At a glance
The stack and who lives there
| Layer | Contains | Example |
|---|---|---|
| 4. Applications | the apps | FestConnect, Contacts |
| 3. App Framework | Java API managers | Activity Manager |
| 2. Libraries + Runtime | C/C++ libs, ART/Dalvik | SQLite, ART |
| 1. Linux Kernel | drivers, memory, power | camera driver |
Think first
Trace a save
FestConnect saves a registration to a small on-device database. Which layer provides that database engine, and which layer ultimately writes the bytes to storage hardware? Name both.
Show the answer
The database engine is SQLite, a native library in layer 2. But SQLite does not touch the flash chip itself; it asks the Linux kernel (layer 1) via drivers to actually write the bytes to storage. So a single save travels down: your app (4) calls a framework API (3), which uses SQLite (2), which relies on the kernel (1). Every real action walks down the stack to the kernel and back.
Quiz
In the Android stack, where does the Linux kernel sit, and what is directly above your applications?
- Kernel at the bottom; nothing is above applications, they are the top layer
- Kernel at the top; applications sit on the kernel directly
- Kernel in the middle; applications are at the bottom
- There is only one layer, so order does not apply
Show the answer
Kernel at the bottom; nothing is above applications, they are the top layer
The Linux kernel is the bottom foundation, and applications are the topmost layer with nothing above them (A). The kernel is never at the top (B) nor the middle (C): it must be closest to the hardware. Android is explicitly a four-layer stack, so order matters a great deal (D is false). Remember the order bottom-up: Kernel, Libraries+Runtime, Framework, Applications.
Watch out
Architecture traps
1. Flipping the order: the kernel is at the bottom (near hardware), apps at the top. Drawing it upside down loses marks.
2. Putting the runtime in the wrong layer: ART/Dalvik lives in layer 2 (with native libraries), not the framework.
3. Thinking apps talk to the kernel directly: they go through the framework and libraries. A layer only calls the layer below it.
Theory
Next: zoom into the runtime
Layer 2 hid something important: the runtime that actually executes your app, the Dalvik Virtual Machine (and its successor ART). The next lesson zooms into it: why Android needed its own VM instead of the standard Java one, and how it runs your compiled FestConnect code efficiently on a battery-powered phone.
Summary
Key takeaways
- Android is a four-layer software stack; each layer uses the one below it.
- Bottom to top: Linux Kernel; Native Libraries + Android Runtime; Application Framework; Applications.
- Kernel handles drivers/memory/power; libraries include SQLite/WebKit/OpenGL; the runtime (ART/Dalvik) runs app code.
- The framework offers Java API managers (Activity Manager, etc.) that apps code against.
- Your apps are the top layer; they reach hardware only by going down through the stack.
- Memory hook: a four-storey building, foundation (kernel) to apartments (apps).