Your first Compose screen
5 minInstall Android Studio, start a Compose project, and turn its Greeting into Rapido's Book Cab button while the preview redraws. Then run it on a Galaxy and meet its AI agent.
Lesson video
Tastebud · 5:04 · Captions on screen
A composable is a Kotlin function that draws part of the screen, and its preview updates as you edit.
- Why. Small functions can each be previewed alone, so you check one button in seconds without tapping through the whole app to reach it.
- Real example. Rapido's ride screen ends in a full-width yellow Book Cab button. Rebuilt in Compose, it's one Button and three modifier lines, each visible in the preview. (Rapido, Nov 2026)
- When to break it. Skip the preview for screens that load from the network or read files. Previews can't reach either, so run that screen on the phone instead.
- Common mistake. Calling a screen done because the preview looks right. The preview can't show how it feels in one hand, so run it on a Galaxy first.
Our take. Run your first composable on a real Galaxy on day one, before you trust the preview or the emulator. A fast laptop hides how a screen feels in one hand on a mid-range phone.
Install Android Studio and run on your Galaxy
Android Studio Rabbit 2 is free for Mac, Windows and Linux. The first hour runs from an empty computer to the Book Cab button on your own Galaxy.
Your first hour in Android Studio ends with Book Cab on your own Galaxy
- Install Android Studio Rabbit 2. Free for Mac, Windows and Linux. Its setup wizard fetches the Android tools.
- New Project, Empty Activity. Empty Activity is the starting point for Compose projects. Click Next, then Finish.
- Open MainActivity.kt in Split. The preview works before any phone is connected. If it's blank, click Build & Refresh.
- Turn on Developer options. On a Galaxy, tap Build number seven times, under Settings > About phone > Software information.
- Turn on USB debugging. Plug the phone in and allow debugging. Windows may need Samsung's USB driver; a Mac needs nothing extra.
- Pick the Galaxy and Run. Choose it in the device menu and click Run, and Book Cab draws on your own phone.
Get AI help without losing track of the code
Android Studio's built-in agent can write and fix Compose code, free for individuals. You can also pick Claude Agent in the agent window, or run Claude Code on the same folder. Use one at a time, and read each change.
Three ways to bring an agent to the same Kotlin files
- The built-in agent. Gemini in Android Studio. The free tier uses a lighter model with a small context window; a Gemini API key or a Google One plan gives you more.
- Claude Agent in Android Studio. Open the agent window, choose Claude Agent, and sign in with your Claude plan or an API key. More agents are under Settings > Tools > AI > Agents.
- Claude Code in a terminal. Run claude in the project folder. Put your rules, such as the 48 dp minimum, in CLAUDE.md so every session starts with them.
Try it
Shape the Book Cab button line by line
This is a Material 3 Button in Material's default purple. Turn the modifier lines on and off, and watch the preview become a full-width button like Rapido's.
- Button(onClick = onBook) { Text("Book Cab") }
Compose reads the chain from the outside in, so the first modifier is the outside layer.
What to notice: Turn on .fillMaxWidth and the button spans the screen. In Compose the first line is the outside layer, so .padding keeps 16 dp clear on each side of the purple. .heightIn makes the button itself 48 dp tall. Rapido's yellow comes later, with theming.
Quick check
A teammate's composable shows a list loaded from your server, and its preview is blank. What's going on?
Watch next
Watch it for Interactive mode, UI Check and other preview features that save you a trip to the emulator.
Watch it for How the agent in Android Studio helps prototype features, test them and keep a project healthy.
Connects to: 14.1 iPhone vs Android · 15.1 Your first SwiftUI screen · 17.1 React Native and Expo
Sources · checked Nov 2026
- Android Studio releasesAndroid Studio Rabbit 2 (2026.2.2 Patch 3) downloads for Windows, Mac and Linux; Bring Your Own Agent lets you pick Claude Agent in the agent window and sign in with a personal subscription or an API key; more agents under Settings > Tools > AI > Agents
- Android Developers: Install Android StudioThe Android Studio Setup Wizard downloads the Android SDK components needed for development
- Android Developers: Create a projectNew Project on the Welcome screen; Empty Activity is the recommended start for Compose projects; Kotlin is the recommended language
- Android Developers codelab: Create your first Android appClick Split at the top right to see code and design together; a blank Design view asks you to click Build & Refresh
- Android Developers: Meet Android Studio, the user interfaceThe main window's toolbar, editor and tool windows such as Project
- Android Developers: Preview your UI with composable previewsA composable is a function marked @Composable; @Preview shows it in the design view with live updates as you edit; previews have no network or file access
- Android Developers: Run apps on a hardware deviceTurn on USB debugging; macOS needs no extra setup and Windows may need an OEM USB driver; wireless debugging; device mirroring in Running Devices
- Android Developers: Configure on-device developer optionsOn Samsung Galaxy, Settings > About phone > Software information > Build number; tap it seven times to turn on Developer options
- Android Developers: AI in Android StudioThe individual tier is free, with a lightweight Gemini and a small context window; a Gemini API key or Google One raises limits; you can use the agent of your choice
- Android Developers Blog: Use any AI agent in Android Studio (24 Sep 2026)Claude Agent, Codex or Antigravity in Android Studio's agent window (announced for the Rabbit 2 canary)
- Android Developers: Compose BOM mappingCompose BOM 2026.11.01 maps to Compose 1.13.0 and material3 1.5.0
- Android Developers: Make apps more accessibleTouch targets of at least 48 x 48 dp; Material components such as Button already enforce this minimum
- Rapido on Google Play (screenshots)The ride choice screen lists Bike, Auto and Cab Economy with prices, then Cash, Offers and a full-width Book Cab button
- Claude Code docs: Memory (CLAUDE.md)Claude Code reads a project CLAUDE.md at the start of every session
- Kotlin releasesKotlin 2.4.21 (8 Oct 2026) is the current stable release