◆ Winter saleAll 3 kits for $29 instead of $49.See the offer →
← All posts

Claude Code for Android: what my frozen first build taught me

By Wajahat Karim · December 5, 2026 · 7 min read

Claude Code for Android, what my frozen build taught me: a terminal where the first Gradle build is killed at the 2 minute shell timeout and the next one waits on a lock in ~/.gradleBuild a mobile app with AI. 0 to store review in 5 hours.$29 →

I'm honestly obsessed with Claude Code. I build NowKit with it every day. But the first time I let it run a fresh Android build, my terminal froze for 47 minutes.

Short answer: Yes, Claude Code can build Android apps from your terminal. Install JDK 17, the Android SDK and Claude Code, then run claude in your project folder. Give it a short CLAUDE.md or AGENTS.md that says where code goes and how to build. It builds with ./gradlew and installs with adb. Let long Gradle builds finish in the background, and never kill one.

Here's what happened. Claude wrote a clean Compose screen and ran ./gradlew :app:assembleDebug. A fresh project downloads about 1 GB on its first build.

Claude Code gives a shell command 2 minutes by default. At the 2 minute mark, it killed Gradle in the middle of the download.

Then it ran the build again. Nothing. No error, no progress. Only a blinking cursor.

I stared at that cursor for 47 minutes. I restarted my Wi-Fi router twice and complained about my internet in two family groups.

The real reason was lock files. The killed build left them in ~/.gradle, and the new build was politely waiting for them to go away. They never would.

I learned it the hard way. Now long builds are the first thing my kit commands plan for.

Can Claude Code build Android apps?

Yes, and the terminal is the reason. It writes Kotlin and Compose, runs Gradle, reads the error, fixes the file and builds again. You don't copy anything.

Here's where it's great and where it's not, from my daily use:

TaskHow Claude Code does
Writing Compose screensVery good, better with a screenshot of the design
Fixing Gradle compile errorsVery good, when it fixes the first error, not the last
Wiring a ViewModel, repository and RoomGood, when the project has one example to copy
Picking library versionsRisky. It can suggest versions that don't exist
Big AGP or Kotlin upgradesRisky in one jump. Do small groups and build after each
Seeing a visual bug on your phoneCan't, unless you give it a screenshot
Play Console and store productsCan't click web consoles. It tells you the steps
Long first buildsTimes out, unless it runs them in the background

So I let it write and build. I look at the phone, and I click the consoles.

Still choosing between this and a prompt-to-app builder? I compared them in my vibe coding app guide.

How do you set up Claude Code for Android?

Install the Android tools once, install Claude Code, then open it in your project. It takes about an hour, mostly downloads.

Five steps to set up Claude Code for Android: JDK 17 checked with java -version, the Android SDK through Android Studio once, Claude Code with its install script, a CLAUDE.md under 200 lines, then run claude in your project folder

  1. Install JDK 17 and check it with java -version.
  2. Install Android Studio once, only for its SDK Manager.
  3. Set ANDROID_HOME and add platform-tools to your PATH. My setup guide has the commands per system.
  4. Check that adb --version prints a version.

Then install Claude Code from Anthropic's setup page:

curl -fsSL https://claude.ai/install.sh | bash   # macOS, Linux, WSL
irm https://claude.ai/install.ps1 | iex          # Windows PowerShell

Run claude --version in a new terminal. Then cd into your project and run claude.

Claude Code running /kit-start-setup in an Android project: a prerequisites table with macOS, local.properties created, the Android SDK path verified, and Gradle wrapper 8.14.5 with JDK 17

The first thing my kit does in Claude Code: check the SDK, JDK 17 and the Gradle wrapper before touching any code.

It needs a paid Claude plan or a Console account. The free plan doesn't include it.

Optional, and worth it: Google ships an Android CLI for coding agents with emulator and SDK commands. It installs as a Claude Code plugin.

What should a CLAUDE.md for an Android project say?

Your stack, where new code goes, which files to leave alone, and the exact build commands. Keep it short. Without it, every prompt is a fresh guess.

Run /init and Claude drafts one by reading your code. Then cut it down. Anthropic suggests keeping it under 200 lines. Mine look like this:

# My app

Kotlin + Jetpack Compose + Material 3. Single `app` module, package-by-feature.
DI: Koin. Data: Room + DataStore. Navigation: type-safe routes in Route.kt.

## Rules
- New screens go in feature/<name>/. Leave core/ alone unless asked.
- Every user-facing string goes in res/values/strings.xml.
- Don't change gradle/libs.versions.toml without asking.

## Build
- Compile check: ./gradlew :app:compileDebugKotlin
- Builds take minutes. Run them in the background and wait. Never kill Gradle.

Using other agents too? Write the rules once in AGENTS.md. Claude Code reads AGENTS.md only when there's no CLAUDE.md in the project.

If you have both, it reads CLAUDE.md. So put a line with @AGENTS.md inside it to import the shared file. Anthropic's memory docs have the details.

That's how my kits work. One AGENTS.md for 5 agents, OpenCode included, and a tiny CLAUDE.md that imports it.

Test it in a fresh session. Ask "how do I add a new screen here?" If Claude answers with your real file names, you're good.

How do you turn repeated prompts into slash commands?

Save the prompt as a Markdown file in .claude/commands/, and its file name becomes the command. If I type the same long prompt twice, it becomes a custom slash command. A file at .claude/commands/run-app.md becomes /run-app. Anything you type after the name lands in $ARGUMENTS.

---
description: Build, install and launch the app on a connected device
---

1. Run `adb devices`. If nothing is listed, stop and tell me to connect a phone.
2. Run `./gradlew :app:installDebug` in the background and wait. Never kill it.
3. If it fails, show me the first error line and explain it in one sentence.
4. Launch the app with adb shell monkey and the applicationId from app/build.gradle.kts.

Commit the .claude/ folder, so anyone who clones the project gets the commands too. My kits ship 30 /kit-* commands built this way.

Why does Claude Code kill my Gradle build?

Because of its shell timeout. A foreground command gets 2 minutes by default and 10 minutes at most (as of December 2026), per Anthropic's settings docs. A first Android build often needs 10 to 30.

Bar chart in minutes: Claude Code's default shell timeout is 2 minutes and its maximum is 10, while a first Android build takes 10 to 30 minutes because it downloads about 1 GB

The fix is a rule: let Gradle finish. I tell Claude this before the first build:

This is the first build. It downloads about 1 GB.
Run it in the background, check the output every 30 seconds, and never stop it.

Or run the first build yourself in a second terminal, and tell Claude when it's done.

The commands I use daily, always with the wrapper, never a system gradle:

./gradlew :app:compileDebugKotlin   # fast compile check
./gradlew :app:installDebug         # build and install on your phone
./gradlew bundleRelease             # release AAB, needs signing set up

If a build already hangs with no output, a killed build left its locks. Stop Gradle, delete the locks, and build again:

pkill -f GradleDaemon; pkill -f GradleWrapperMain
find ~/.gradle -name '*.lock' -delete

When a build fails, the useful line is the first e: line, not the wall of text at the bottom. Ask Claude to fix that one first.

How do you run the app on a phone or emulator?

Connect a phone with USB debugging on, or start an emulator, check adb devices, then run ./gradlew :app:installDebug and launch it with adb.

  1. On a real phone, turn on Developer options → USB debugging and accept the prompt.
  2. Or start an emulator from Android Studio's Device Manager or the Android CLI.
  3. Run adb devices and check your device is listed.
  4. Run ./gradlew :app:installDebug.
  5. Launch it: adb shell monkey -p YOUR_APP_ID -c android.intent.category.LAUNCHER 1.
  6. If it crashes, ask Claude to read adb logcat -d '*:E'.

For visual bugs, screenshot the phone and drag it into the session. One picture of a button under the navigation bar beats three paragraphs.

Claude Code terminal generating the Compose screens of a notes app from mockups: 11 minutes in, with a checklist of phases from picking the design to wiring functionality

This is Claude Code building a notes app from my mockups, 11 minutes in. It found that Compose 1.8 can render the mockup's italics and wrote the screens. I was making tea.

So, if your first build goes quiet, don't stare at it for 47 minutes like me. Check ~/.gradle for lock files before you blame your internet.

If you want Claude Code to start from an Android app that already has sign-in, a paywall and these build rules in its AGENTS.md, that's NowKit. /kit-run-app builds, installs and launches in one command. When you're ready for the store, my Google Play publishing guide picks up from there.

Frequently asked questions

Can Claude Code build Android apps?

Yes. It writes Kotlin and Compose, runs Gradle and installs the app with adb, all from the terminal. You need JDK 17 and the Android SDK on your machine, same as any Android build.

Do I need Android Studio to use Claude Code for Android?

Once, to install the SDK through its SDK Manager. After that I do the daily work in the terminal. I still open it sometimes for the layout inspector.

Does Claude Code read AGENTS.md?

Yes, when there's no CLAUDE.md in the project. If you have both, it reads CLAUDE.md, so add the line @AGENTS.md inside it to import the shared file.

Why does my Gradle build time out in Claude Code?

Foreground shell commands time out after 2 minutes by default, and 10 minutes at most. A first Android build can take 10 to 30 minutes. Ask Claude to run it in the background and never kill it.

My Gradle build hangs with no output. What now?

A killed build left lock files in ~/.gradle. Stop any Gradle process, delete the *.lock files there, and build again. Then let it finish.

Is Claude Code free?

No. It needs a paid Claude plan or a Console account. The free Claude.ai plan doesn't include it.

Can Claude Code build iOS apps too?

Yes, on a Mac with Xcode. It writes SwiftUI and builds from the command line. You still need an Apple Developer account to ship to the App Store.

Claude Code and AI agents

Related guides