Skip to content
Winter Sale from $619, until 31st December 2026 Book now
Agentic coding tools & comparisons Android · Google Play Claude Code

Claude Code for Kotlin and Jetpack Compose: An Android Setup That Compiles

Claude Code works well on Android projects because everything it needs runs from the command line: Gradle builds, unit tests, lint and an emulator it can screenshot through adb. Give it the exact Gradle tasks, your Compose conventions and a list of files it must not touch – keystores, signing config, manifest permissions – and most feature work ends with a green build instead of a red one.

8 min read

Key takeaways

  • The Android toolchain runs on Linux and macOS, so Claude Code can build and unit-test anywhere; only the emulator needs hardware acceleration.
  • Module-scoped Gradle tasks with --console=plain keep the feedback loop fast and the logs readable for the agent.
  • Write your Compose conventions down: state hoisting, ViewModel with StateFlow, Material 3 tokens, version catalog only.
  • Screenshot tests and adb screenshots let the agent check UI it cannot see in the preview pane.
  • Signing config, applicationId, targetSdk and manifest permissions are Google Play decisions – keep them behind an approval.

Why Android projects suit a terminal agent

On iOS, an agent needs a Mac with Xcode for every build. Android has no such gate: the Gradle wrapper, the JDK and the Android SDK command-line tools run on Linux, macOS and Windows. Claude Code can therefore verify its changes on a laptop, in a dev container or on a CI runner. What changes between those places is the emulator:

Where Claude Code runsBuild, unit tests, lintEmulator and UI testsBest for
Developer laptopYesYesUI work, debugging with a human nearby
Dev container or remote Linux machineYesOnly with hardware acceleration (KVM)Unattended tasks without access to personal accounts
CI runner with claude -pYesPossible, slow to startSmall scripted fixes on a branch

Before the first session, check the basics the agent will otherwise trip over: the JDK version your Android Gradle Plugin requires, ANDROID_HOME pointing at the SDK, and a Gradle wrapper that is committed and works from a clean checkout.

Gradle tasks are the agent's feedback loop

Claude Code learns whether a change works from the tasks you give it. Choose them for speed first:

TaskWhat it tells the agent
./gradlew :app:compileDebugKotlinThe fastest answer to "does it compile?"
./gradlew testDebugUnitTestJVM unit tests for ViewModels, repositories and use cases
./gradlew lintDebugAndroid Lint: API level misuse, missing permissions, accessibility hints
./gradlew ktlintCheck or detektStyle and static checks – only if the plugin is set up in your build
./gradlew connectedDebugAndroidTestInstrumented and Compose UI tests on a running emulator or device

Three habits keep the loop under a minute. Use module-scoped tasks in multi-module projects (:feature:profile:testDebugUnitTest instead of the whole build). Enable the Gradle build cache and configuration cache in gradle.properties. And pass --console=plain, which drops the progress animation that otherwise fills the agent's context with noise.

Release tasks such as bundleRelease belong in CI, where the upload key lives – not in the agent's terminal.

Talk to an AI Code Engineer about shipping your app to Google Play.

In a free call we look at what you built, tell you honestly what stands between it and an approved release – and whether you need us at all.

A CLAUDE.md for a Compose codebase

Compose leaves a lot of room for style, and agents fill that room with whatever pattern they saw most often. Your CLAUDE.md narrows it down:

# Android app – notes for Claude Code

## Environment
- JDK 17 (see .java-version). ANDROID_HOME must be set; never edit local.properties.
- Modules: :app, :core:data, :core:ui, :feature:* (one module per screen family)

## Commands (repo root, always with --console=plain)
- Compile: ./gradlew :app:compileDebugKotlin
- Tests:   ./gradlew testDebugUnitTest
- Lint:    ./gradlew lintDebug
- UI:      ./gradlew connectedDebugAndroidTest   (only if `adb devices` lists an emulator)

## Kotlin and Compose
- Dependencies only through gradle/libs.versions.toml; Compose versions come from the Compose BOM.
- Screen = stateless composable + ViewModel exposing StateFlow<UiState>; collect with collectAsStateWithLifecycle().
- Hoist state. No ViewModel parameters below the screen-level composable.
- Material 3 components and theme tokens only – no hard-coded colors or text sizes.
- Every screen has light and dark @Preview functions and a Compose UI test using testTag.
- Coroutines: viewModelScope, injected dispatchers, never GlobalScope.

## Ask before changing
- app/build.gradle.kts: signingConfigs, applicationId, minSdk, targetSdk, versionCode
- AndroidManifest.xml permissions and exported components
- proguard-rules.pro, keystore.properties, any *.jks or *.keystore file

Each rule prevents a specific failure. The version catalog rule stops the agent from pasting a dependency with a hard-coded version it remembered. The state rules keep composables previewable and testable. And the "ask before changing" block exists because those lines are not code style – they decide what Google Play sees. Our guide to memory files for mobile projects shows how to share these rules with other agents.

Letting the agent see what it built

The preview pane in Android Studio is invisible to a terminal agent. Three replacements, from cheapest to most realistic:

  • Compose UI tests. With createComposeRule() and test tags, the agent can assert that a button exists, is enabled and leads to the right state. These tests also document the screen.
  • Screenshot tests. Google's Compose Preview Screenshot Testing plugin turns @Preview functions into reference images, while Roborazzi and Paparazzi render screenshots on the JVM without an emulator – useful in containers. A changed pixel becomes a failing test with a diff image the agent can open.
  • Emulator screenshots. Install, start and capture:
./gradlew :app:installDebug --console=plain
adb shell am start -n com.example.notes/.MainActivity
adb shell cmd uimode night yes
adb shell settings put system font_scale 1.3
adb exec-out screencap -p > screen.png

Claude Code reads the PNG and can compare it with a mockup in the repository. Switching dark mode and font scale before the capture catches the problems users report most: unreadable contrast and clipped text.

Guardrails: permissions, hooks and the files Google Play cares about

A shared .claude/settings.json pre-approves the safe commands and keeps the agent away from signing material:

{
  "permissions": {
    "allow": [
      "Bash(./gradlew:*)",
      "Bash(adb exec-out screencap:*)",
      "Bash(adb shell am start:*)"
    ],
    "deny": [
      "Read(**/*.jks)",
      "Read(**/*.keystore)",
      "Read(./keystore.properties)",
      "Read(**/play-service-account*.json)"
    ]
  }
}

A Stop hook that runs the compile task when Claude Code wants to finish is a cheap safety net: configured to report failures back, it sends the agent back to work instead of handing you a broken build.

Why the manifest and build file deserve extra care: a new permission changes what you must declare in the Data safety form; an exported activity without a permission is a security hole; raising targetSdk changes runtime behaviour; and R8 rules that look like clutter keep reflection-based code alive in release builds. That last one is sneaky – the debug build works and the release crashes – so let CI build a minified variant for every pull request.

Larger codebases: modules, subagents and parallel sessions

In a multi-module app, a short CLAUDE.md inside a module (for example feature/payments/CLAUDE.md with the Play Billing rules) is loaded when the agent works there, so the root file stays short. A custom subagent defined in .claude/agents/ with read-only tools can review diffs for Compose pitfalls: missing remember, unstable lambda parameters, lists without keys, work on the main thread.

Parallel sessions in separate git worktrees speed up independent tasks, but every Gradle daemon wants memory. Cap org.gradle.jvmargs and run two or three sessions, not ten. Migrations are where agents shine: XML layouts to Compose one screen at a time, kapt to KSP, deprecated APIs flagged by lint – each step guarded by an existing screenshot or UI test.

From a green build to Google Play

New apps ship as Android App Bundles with Play App Signing; you keep the upload key, and it should never be readable by the agent. Since August 31, 2026, new apps and updates must target Android 16 (API level 36) – see our target API level guide. New personal developer accounts also need a closed test with at least 12 testers over 14 days before production; the closed testing playbook explains how to run it. The release side is covered step by step in Claude Code app to Google Play.

If you would rather not handle signing, tracks and the Play Console yourself, our AI Code Engineers do it in your own developer account through the Android submission service – and our Android workshops teach your team this setup on your own codebase.

Claude Code Android setup checklist

  • JDK, ANDROID_HOME and the Gradle wrapper work from a clean checkout.
  • CLAUDE.md lists module-scoped compile, test, lint and UI test commands with --console=plain.
  • Compose conventions cover state hoisting, ViewModel state, theme tokens and the version catalog.
  • The agent can check UI through Compose UI tests, screenshot tests or adb screenshots.
  • .claude/settings.json denies keystores, keystore.properties and service account files.
  • Signing config, applicationId, targetSdk and manifest permissions require approval.
  • CI builds a minified release variant for every pull request.

Frequently asked questions

Is Claude Code a replacement for Gemini in Android Studio?

They work differently. Gemini's agent mode lives inside the IDE; Claude Code works in the terminal and across your whole repository, scripts and CI. Many Android developers keep both and choose per task – and both benefit from the same written conventions.

Can Claude Code run the Android emulator inside a container?

Only if the container has hardware acceleration such as KVM. Otherwise run builds and JVM tests in the container, use JVM screenshot tests for UI checks, and do emulator work on a developer machine.

How do I stop Claude Code from adding random dependencies?

Write the rule into CLAUDE.md (dependencies only through the version catalog, new libraries only after approval) and review every diff to libs.versions.toml. A new library can change your Data safety answers, so it deserves a human decision.

Can you help us publish our Android app?

Yes. Book a free call and an AI Code Engineer reviews your project with you. We can set up signing, CI/CD, the closed test and the store listing in your own Play Console account.

Free, 15 minutes, no obligation

Get your app from agent output to approved release.

Our AI Code Engineers take apps built with Claude Code, Codex, Cursor, Lovable, Base44 and co. through signing, CI/CD, store listings and review – in your own developer accounts.

AI tools, store policies and requirements change quickly – always check the current documentation of the tools and stores you use. This article is independent advice and not affiliated with or endorsed by Apple, Google, Anthropic, OpenAI or any other company or product mentioned; all trademarks belong to their owners.