Learning goals
The text in your editor and the app on your phone are connected by a build pipeline. Follow one small app through that pipeline, then see how Android turns its installed code into a running screen.
- Separate the jobs of Android Studio, Gradle, the compiler, and the Android Runtime.
- Trace Kotlin source, resources, and the manifest into a signed application.
- Explain which artifact a device installs and how an Activity displays Compose UI.
Before you begin
Watch code become an app
Press Play to follow the journey. Pause at a stage, inspect its input and output, or move one step at a time. The diagram is a teaching model: a real build has many dependent tasks and can reuse cached results.
From your first line to a running app
Follow one Kotlin screen through the tools that build it and the Android system that runs it.
Write
Android Studio is your workspace. Write Kotlin in the editor, describe the UI with Compose, and add resources and an Android manifest. The editor helps you write code; it is not the compiler.
Text("Hello, Android!")Editor, compiler & build system
Android Studio is the development environment: its editor helps you write code, its debugger helps inspect a running app, and its device tools let you test. Pressing Run asks the build system to prepare an application and then deploy it to the selected device.
| Tool | Its responsibility | What to remember |
|---|---|---|
| Android Studio | Editing, previews, debugging, and device tools. | The editor is where you work. |
| Gradle + Android Gradle Plugin | Coordinate dependencies, build variants, and Android build tasks. | The build system organizes the work. |
| Kotlin compiler | Check and translate Kotlin source into JVM bytecode for this Android project. | A compiler translates code. |
| Android SDK tools | Process resources, produce DEX code, package, and sign. | Different tools handle different inputs. |
| Android Runtime (ART) | Execute managed app code on the Android device. | The runtime operates after installation. |
Gradle can also run from a terminal without opening the IDE. That is why the same project can be built on your laptop or a build server. See the Android build guide for the underlying configuration.
Inside the build
Start with three inputs: Kotlin files contain behavior, res/ holds resources such as strings and icons, and AndroidManifest.xml declares app components and other platform information. Libraries contribute code and may contribute resources and manifest entries too.
The Kotlin compiler produces JVM bytecode. The Android build then needs DEX, the managed bytecode format used on Android. D8handles this conversion in a typical debug build. When release optimization is enabled, R8also shrinks and optimizes code while producing DEX output. A release build does not automatically mean every optimization is enabled.
Alongside code processing, AAPT2 compiles and links Android resources. The build merges manifest information and packages the required outputs. These are related task paths; resources do not pass through the Kotlin compiler as Kotlin source.
Compose still uses the Android build pipeline
APK, AAB & installation
| Artifact | Purpose | Installed directly? |
|---|---|---|
| APK · Android Package | Contains installable app code, resources, manifest information, and a signature. | Yes, when compatible and properly signed. |
| AAB · Android App Bundle | Publishing artifact used to generate APKs suited to a device. | No. A device installs the resulting APKs. |
Debug builds are signed with a development key so you can install and test them. Distribution uses a deliberate release signing setup. With Google Play App Signing, an upload key signs the uploaded bundle and the app signing key signs the APKs delivered to users. See the app signing guide and App Bundle guide for these delivery details.
What happens on the device
After installation, tapping a launcher icon asks Android to open the declared launcher Activity. Android starts the app process if needed and creates that Activity. ART executes managed DEX code, using interpretation and compiled code as appropriate; your phone is not opening the original Kotlin file.
// Keep the package declaration generated for your project.
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Text(text = "Hello from my Android app!")
}
}
}
}Android calls onCreate. The Activity calls setContent to host Compose, and composable functions describe the interface. Compose manages composition, layout, and drawing as needed. Later state changes can update the UI without rebuilding or reinstalling the application.
Follow your own build
- Open your Compose project. Find
MainActivity.kt,AndroidManifest.xml, andres/. - Change the greeting to a phrase you will recognize, then run the app on an emulator.
- Inspect the Build output. Identify a Kotlin compilation task and Android packaging tasks; exact task names vary by plugin and variant.
- Build a debug APK and inspect it with Android Studio's APK Analyzer. Look for DEX files and the packaged manifest.
- Explain the journey aloud: source inputs → build tasks → signed APK → installation → Activity → visible UI.
Check your result
Quick check & references
Key takeaways
- Android Studio supports development; Gradle coordinates a build; compilers and SDK tools transform its inputs.
- Kotlin source becomes JVM bytecode and then Android DEX code. Resources follow their own processing path.
- APKs are installed. An AAB is used to generate APKs for distribution.
- On the device, Android manages components and ART executes managed code; Compose produces the screen from state.
Quick check
1. Which tool coordinates the build tasks and dependencies?
2. What does a device install when an app is delivered from an Android App Bundle?
3. What is the role of D8 in a typical debug build?
Continue with the Android build guide, APK Analyzer documentation, and Android Runtime overview. In the callback lesson, follow the framework calls that bring an Activity to life.