Phase 1 · Getting Started with ComposeModule 2~26 min read

Setting Up Android Studio

Install the tools, create your first Compose project, and run it on an emulator or device.

What you'll learn

Every Android app is built in Android Studio, Google's official IDE. In this module you'll install it, create your first Compose project, learn what all the generated files do, and run the app on an emulator or a real phone.

By the end you'll be able to:

  • Install Android Studio and the SDK
  • Create a new Jetpack Compose project
  • Recognise the key files in a project
  • Run an app on an emulator or device

Installing Android Studio

Download Android Studio from the official site and run the installer — it bundles the IDE and the Android SDK (the toolkit that compiles and runs your apps). On first launch, the setup wizard downloads the SDK components and a system image for the emulator. It's a large download, so give it time and a good connection.

Tip

Android Studio wants a fair bit of memory — 8 GB of RAM is a practical minimum, 16 GB is comfortable, especially when the emulator is running. If your machine is modest, you can run on a real phone instead of the emulator (more on that below), which is lighter and often faster.

Creating a project

Choose New Project, then the Empty Activity template — the one with the Compose logo. Give your app a name and a package name (a unique identifier like com.yourname.myapp, usually your domain reversed). Android Studio scaffolds a complete, runnable Compose app for you, already wired up and ready to go.

Project structure

A fresh project has more files than you'll touch at first. These are the ones that matter early:

File / folderWhat it is
MainActivity.ktYour app's entry point — it calls setContent to show your Compose UI
ui/theme/Your app's colours, typography, and theme (Material 3)
AndroidManifest.xmlDeclares the app, its activities, permissions, and icon
build.gradle.kts (app)Dependencies and build config for your app module
res/Resources: images, strings, and launcher icons

The heart of it is MainActivity. Its onCreate runs when the app launches, and setContent is the bridge into Compose — everything inside it is your UI:

MainActivity.kt
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {                 // hand the UI over to Compose
            MyAppTheme {
                Greeting("Android")
            }
        }
    }
}

Note

ComponentActivity is the modern Activity base class for Compose apps. The MyAppTheme wrapper applies your app's Material theme (colours, fonts) to everything inside — you'll customise it in Module 14.

Running your app

You have two ways to see your app run:

  • Emulator — a virtual phone on your computer. Create one in the Device Manager (an "AVD"), pick a phone and Android version, and launch it.
  • Physical device — enable Developer Options and USB debugging on your phone, plug it in, and it appears as a target.

Then press the green Run ▶ button. Gradle builds your app, installs it, and launches it. The first build is slow (Gradle downloads dependencies); later builds are much faster.

Tip

You often don't even need to run the full app to see your UI — the @Preview pane renders composables right inside the editor, instantly. That's the subject of the next module and the single biggest reason Compose is fast to work in.

Recap & quick check

Key takeaways

  • Android Studio is the official IDE; it bundles the Android SDK that builds and runs your apps.
  • Create apps from the Empty Activity (Compose) template with a unique package name.
  • MainActivity.kt is the entry point; setContent hands the screen to your Compose UI.
  • Key files: MainActivity.kt, ui/theme/, AndroidManifest.xml, build.gradle.kts, and res/.
  • Run on an emulator (AVD) or a physical device with USB debugging via the Run button.

Quick check

1. What is Android Studio?

2. Which template should you pick for a new Compose app?

3. What does setContent do in MainActivity?

4. What is an AVD?

5. What must you enable to run on a physical phone?

Your tools are ready. Now let's write and understand your very first composable — line by line.