Phase 1 · Getting Started with ComposeModule 3~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

We will build this course's apps 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

Check the official requirements for your operating system before installing. For example, the Windows requirements distinguish 8 GB for Studio alone from 16 GB for Studio with the emulator, with 32 GB recommended. On a modest machine 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")
            }
        }
    }
}
Focused example: keep your generated package and theme. Add the shown APIs to your Compose project using Android Studio imports.

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 the Styling, Theming & Dark Mode lesson.

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 after the required build or refresh. That's the subject of the next module and the single biggest reason Compose is fast to work in.

Practice: one small working feature

Create an Empty Activity project with Kotlin and Compose. Change the welcome text and run it.

Check your result

Your edited text appears on an emulator or device. Locate MainActivity, the app build file, and strings.xml.

Remember

Use the compatible versions generated by Android Studio. Solve the first Gradle error before changing unrelated settings.

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.