Blog – Page 4

Understanding AI Agents: Concepts, Architecture, and Tools

AI agents are a paradigm shift in how we design and interact with artificial intelligence. AI agents are programmed not only to respond to a single query but to reason, plan, act, and iterate on their own in order to reach a goal.

This piece will examine what AI agents are, how they function, what distinguishes them from traditional AI processes, the skills needed to excel at agentic AI, and the most popular tools you can currently utilize to build your own AI agents.

What is an AI Agent?

An AI agent is a smart system capable of:

  • Obtain a high-level goal;

  • Break it down into steps;

  • Decide on the tools or actions to employ;

  • Perform those actions;

  • Observe the outcomes and make adjustments in strategy;

Unlike conventional AI models (e.g., chatbots), AI agents are goal-oriented. They do not merely respond to inquiries — they make decisions on what actions to take next. This renders the AI agent a very effective tool for automation, research, testing, software development, data analysis, and decision-making systems.

It is useful to distinguish between:

LLMs → Responses to individual prompts;

Workflows → Predefined, human-designed sequences of steps;

Agents → Systems that choose and control the workflow themselves;

Core Components of an AI Agent

Most AI agents are based upon a few key elements:

Reasoning Engine

The reasoning layer is accountable for goal understanding, task breakdown, and determining the best possible next action. This is usually done with the help of an LLM (Large Language Model).

Planning

Planning enables the agent to plan the sequence of actions rather than acting step by step. Some agents plan ahead, while others plan dynamically after the execution of each action.

Memory

Memory enables agents to store: Past behavior, Intermediate results and Long-term knowledge. The knowledge that can be maintained within long-term memory needs to be adequate for the character to progress appropriately in the story. The type of knowledge that should be stored in this region of memory is the ability to ride a bicycle. This skill requires practice, and the character should demonstrate that they have learned it.

Tools & Actions

The agents interact with the world through tools such as: APIs, Databases, File systems or Browsers.

Feedback & Iteration

The agents assess the outcome of their actions and make decisions on whether to continue, retry, or modify their strategy. This process is what gives the agents autonomy. In agentic systems, decision-making is entrusted to the AI itself and not hard-coded by programmers.

Skills Needed to Master Agentic AI

Agentic AI requires more system design skill than prompt writing skill. The important skills are:

Goal Decomposition — The capacity to decompose complex objectives into smaller, solvable tasks that the agent can reason about.

Tool Design — Well-designed tools are essential. Agents work better when tools are: Clearly defined, Narrow in scope and Deterministic when possible.

Evaluation & Guardrails — Agents must have constraints to prevent infinite loops, hallucinations, or unsafe behaviors. These include: Success criteria, Step limits and Validation rules.

Memory Management — How much the agent should remember, and for how long, is a major architectural choice.

Human-in-the-Loop Design — In most practical scenarios, the agents would be working semi-autonomously with human approval checkpoints rather than full autonomy.

Iterative Improvement — Performance is improved through experimentations, logging, and refinements rather than one-shot executions.

Systems Thinking — In Agentic AI, one has to think beyond the response, including orchestration, observability, failure modes, and scalability.

Agent Frameworks for Developers

The environment for developing AI agents is an ever-changing one. Some of the most popular tools being used currently are listed below.

LangChain – A widely used framework that chains LLMs together using tools, memory, and control logic.

CrewAI – Emphasizes the collaboration of multiple agents with defined roles.

AutoGPT-like frameworks – Early autonomous agents that cycled between planning and execution loops.

OpenAI Agent Builder / AgentKit – Tools for building structured, tool-driven agents with safety guardrails.

Koog.ai – A Kotlin‑centric framework for developing AI agents, emphasizing strong typing, modular prompt executors, and a clean separation of reasoning, tools, and orchestration. Especially suited for backend and Android‑adjacent spaces.


Building an Agentic AI Mobile Tester with Koog and Kotlin

Testing Android apps is often repetitive, time-consuming, and hard to scale. Recently, I started experimenting with agentic AI to automate mobile testing—combining Kotlin, Koog, and LLMs to build a smart tester that can execute real end-to-end scenarios.

The result is my new project: Koog - Agentic Mobile Tester.


What is Koog?

Koog is JetBrains’ open-source framework for building AI agents in Kotlin. You define an agent with a Kotlin DSL, give it tools (ordinary Kotlin functions the LLM is allowed to call), and Koog runs the loop: send the goal to the model, execute the tool calls it asks for, feed the results back, and repeat until the task is done.

Koog AI agent framework illustration

The features that mattered most for this project:

  • Tools as Kotlin functions. My ADB actions (tap, typeText, assertTextVisible) became tools with almost no glue code.
  • Several LLM providers behind one API, including OpenAI, Anthropic, Google, OpenRouter and local models through Ollama, so I could switch models per test run.
  • History compression to keep long sessions within the model’s context window, which matters when every step adds a UI hierarchy dump to the conversation.
  • Tracing of LLM calls and tool executions. When an agent does something strange, this is how you find out why.

I started with Koog 0.2.1, with no previous experience writing AI code, and it was the first agent framework that felt like normal Kotlin to me. That’s a big part of why this tester exists.


Why I Built This

As an Android developer, I’ve used Espresso, UIAutomator, and other frameworks. They’re powerful, but still rigid: you need to write detailed test scripts and keep them updated. I wanted to explore whether an AI agent could take high-level goals like “Log in and navigate to the profile screen” and figure out the steps automatically.


How It Works

The project is powered by Koog.ai and Kotlin, using an LLM as the reasoning engine (options include Gemini, Llama, GPT or Qwen). Here’s the flow:

Ktor API & Koog Agent (Backend)

The backend is built with Ktor in Kotlin and powered by a custom Koog agent (MobileTestAgent) plus a toolkit of device actions (MobileTestTools).

Ktor API The Ktor server exposes endpoints that receive test scenarios and configuration (LLM model, temperature, iterations). Each request is routed to the MobileTestAgent, which runs the scenario with the chosen parameters.

MobileTestAgent (Koog Agent) MobileTestAgent encapsulates the Koog agent setup. It translates high-level test goals into an iterative reasoning process, where the LLM plans actions like “tap login button” or “enter text”. The agent respects limits such as max iterations and temperature to balance creativity and determinism.

MobileTestTools (Device Interaction) MobileTestTools provides the executable layer via ADB commands. It includes functions for:

  • Interactions: tap(), typeText(), scroll(), swipe()
  • Checks: assertTextVisible(), getUiHierarchy()
  • Utilities: launchApp(), installApk(), takeScreenshot()

These functions are registered as tools within Koog, so when the agent plans an action, Koog calls the corresponding method directly.

Execution Flow

  • Ktor receives a scenario and sends it to the agent.
  • Koog plans the next step using the LLM.
  • The selected MobileTestTools method executes the action on the device.
  • Feedback (UI state, success/failure) is fed back into the agent.
  • This loop continues until the scenario ends or max iterations are hit.

At the end, a structured report is generated with actions, results, and optional artifacts (like screenshots), and returned to the frontend dashboard.

User Input (Frontend Dashboard)

  • Users create test scenarios (goals & steps) via a ReactJS dashboard.
  • The site was designed with Stitch and stores data in Cloud Firestore.
  • Users can also tweak AI agent parameters like:
    • Model (Gemini, GPT, etc.)
    • Temperature
    • Max iterations

Sample Android App

  • To showcase the system, I created a simple demo Android app.
  • The agent can interact with it and validate flows end-to-end.

Example Flow

  • User defines a scenario:
    “Tap Add Post button → Input “some text” in the Description → Tap Create Post button”

  • The AI agent receives it, plans the steps, and uses ADB actions (tap, type, scroll, assert text).
  • A report is generated with success/failure details.

No need to maintain test scripts—just provide the goal.


Why Kotlin + Koog?

Kotlin gave me the flexibility to build a clean API with Ktor and manage complex agent logic easily. Koog.ai, with its Model Context Protocol (MCP) integration and agentic design, allowed me to connect the LLM with Android tooling like ADB seamlessly.

This mix of Kotlin, LLMs, and Android dev tools opens a new way of thinking about mobile testing: instead of scripting, you describe intentions.


What’s Next

  • Improving reporting (screenshots, videos, structured logs).
  • Expanding to iOS and Web end-to-end testing.
  • Exploring CI/CD integration for real-world teams.


If you’re new to agents, my post on AI agent concepts, architecture and tools explains the building blocks used here.

This was a fun experiment mixing Kotlin + AI agents + Android testing. If you’re curious about agentic AI, Koog, or just want to rethink mobile testing, I’d love feedback, feel free to DM on LinkedIn! 🚀


Exploring Android Studio's Gemini Journeys: AI-Powered Testing Revolution

Android development just got a significant upgrade with the introduction of Gemini Journeys in Android Studio. This innovative AI-powered feature promises to transform how we approach end-to-end testing by leveraging natural language prompts instead of traditional manual test creation.

What is Gemini Journeys?

Gemini Journeys represents a paradigm shift in mobile testing methodology. Instead of writing complex test scripts line by line, developers can now describe their testing intentions in plain English, and Gemini AI translates these prompts into comprehensive end-to-end tests.

The feature integrates seamlessly with Android Studio’s preview environment, offering developers an intuitive way to:

  • Generate automated UI tests through conversational prompts
  • Create comprehensive test scenarios without deep testing framework knowledge
  • Accelerate the testing workflow significantly
  • Reduce the barrier to entry for comprehensive mobile testing

Hands-On Experience: Building with KoinBase

To explore Gemini Journeys’ capabilities, I created a demo project called KoinBase - a simple cryptocurrency tracking application built with Jetpack Compose. The app showcases modern Android development practices while serving as a perfect testing ground for AI-assisted test generation.

Key Features of the Demo:

  • Clean Architecture: Implementing MVVM pattern with proper separation of concerns
  • Jetpack Compose UI: Modern declarative UI framework
  • Dependency Injection: Using Koin for lightweight DI
  • Network Integration: RESTful API consumption for crypto data
  • Material 3 Design: Following latest design guidelines

First Impressions: A Game Changer

After experimenting with Gemini Journeys on the KoinBase project, here are my initial thoughts:

The Good:

  • Intuitive Workflow: Describing test scenarios in natural language feels remarkably natural
  • Productivity Boost: Test creation time reduced significantly compared to manual approaches
  • Intelligent Context: Gemini understands app structure and suggests relevant test scenarios
  • Quality Output: Generated tests are comprehensive and well-structured

The Promise: This technology represents a fundamental shift toward more accessible and efficient mobile testing. For teams struggling with testing coverage or developers new to automated testing, Gemini Journeys could be transformational.

Looking Forward

Gemini Journeys appears to be more than just another AI tool - it’s positioning itself as a genuine game changer for mobile testing workflows. The ability to generate robust E2E tests through conversational prompts could democratize comprehensive testing practices across development teams of all skill levels.

As AI continues to integrate deeper into development workflows, features like Gemini Journeys demonstrate how machine learning can augment human creativity rather than replace it. The future of Android development looks increasingly collaborative between human insight and artificial intelligence capabilities.

Try It Yourself

Interested in exploring Gemini Journeys? Check out the official documentation and consider experimenting with your own projects. The KoinBase demo is also available as a reference implementation.

The intersection of AI and mobile development continues to evolve rapidly, and Gemini Journeys represents an exciting step toward more intelligent, efficient development practices.


Untangling State and Side Effects in Jetpack Compose

State is any value that can change over time and should change what the user sees: the text in a field, whether a button is enabled, the list on screen. In Jetpack Compose, the UI is a function of state, so when state changes, Compose recomposes the parts of the UI that read it. This guide covers where state should live (inside a composable, hoisted to a parent, in a state holder or in a ViewModel) and how side effects like LaunchedEffect and DisposableEffect fit into the composition lifecycle.

I’ve merged an earlier post on the execution order of effects into this one, since you can’t really understand effects without understanding state.

State inside a composable

The smallest unit is state a composable keeps for itself:

@Composable
fun Counter() {
    var count by remember { mutableStateOf(0) }
    Button(onClick = { count++ }) {
        Text("Clicked $count times")
    }
}

Two pieces work together here. mutableStateOf creates an observable value: Compose tracks which composables read it and recomposes them when it changes. remember keeps that value across recompositions; without it, count would reset to 0 every time the function ran.

remember doesn’t survive configuration changes (rotation, dark mode) or process death. For small UI state that should, like a selected tab or a text field, use rememberSaveable, which stores the value in the saved instance state.

State hoisting

Internal state is fine until another part of the UI needs it. A checkbox that tracks its own “checked” value can’t tell its parent, and the parent can’t reset it.

State hoisting moves the state up to the caller. The component receives the current value and reports events through a callback:

@Composable
fun NewsletterCheckbox(
    isChecked: Boolean,
    onCheckedChange: (Boolean) -> Unit
) {
    Row(verticalAlignment = Alignment.CenterVertically) {
        Checkbox(checked = isChecked, onCheckedChange = onCheckedChange)
        Text("Send me the weekly newsletter")
    }
}

@Composable
fun SignUpForm() {
    var subscribed by rememberSaveable { mutableStateOf(false) }
    NewsletterCheckbox(
        isChecked = subscribed,
        onCheckedChange = { subscribed = it }
    )
}

The pattern is called unidirectional data flow: state flows down as parameters, events flow up as lambdas. NewsletterCheckbox is now stateless, so it’s easy to preview, test and reuse, and there’s a single source of truth for subscribed.

A useful rule: hoist state to the lowest common parent of everything that reads or changes it. Not higher.

State holders

When a screen has several related pieces of state and some logic around them, a pile of vars in the composable gets hard to follow. Move them into a plain class:

class LoginFormState {
    var username by mutableStateOf("")
        private set
    var password by mutableStateOf("")
        private set

    val canSubmit: Boolean
        get() = username.isNotBlank() && password.length >= 8

    fun onUsernameChange(value: String) { username = value }
    fun onPasswordChange(value: String) { password = value }
}

@Composable
fun rememberLoginFormState() = remember { LoginFormState() }

@Composable
fun LoginForm(
    onSubmit: (String, String) -> Unit,
    state: LoginFormState = rememberLoginFormState()
) {
    Column {
        TextField(
            value = state.username,
            onValueChange = state::onUsernameChange,
            label = { Text("Username") }
        )
        TextField(
            value = state.password,
            onValueChange = state::onPasswordChange,
            label = { Text("Password") },
            visualTransformation = PasswordVisualTransformation()
        )
        Button(
            onClick = { onSubmit(state.username, state.password) },
            enabled = state.canSubmit
        ) {
            Text("Log in")
        }
    }
}

The composable only describes the layout, and the rules (“submit needs a username and an 8-character password”) live in one class you can unit test without any UI. The private set keeps changes going through the class’s functions.

ViewModel: state that outlives the screen

A plain state holder lives as long as the composable that remembers it. When state has to survive configuration changes, or comes from the data layer (network, database), use a ViewModel. Expose an immutable StateFlow and collect it in the UI:

data class ProfileUiState(
    val isLoading: Boolean = true,
    val name: String = "",
    val error: String? = null
)

class ProfileViewModel(private val repository: ProfileRepository) : ViewModel() {
    private val _uiState = MutableStateFlow(ProfileUiState())
    val uiState: StateFlow<ProfileUiState> = _uiState.asStateFlow()

    fun load(userId: String) {
        viewModelScope.launch {
            _uiState.update { it.copy(isLoading = true, error = null) }
            try {
                val name = repository.fetchName(userId)
                _uiState.update { it.copy(isLoading = false, name = name) }
            } catch (e: IOException) {
                _uiState.update { it.copy(isLoading = false, error = "Couldn't load profile") }
            }
        }
    }
}

@Composable
fun ProfileRoute(viewModel: ProfileViewModel, userId: String) {
    val uiState by viewModel.uiState.collectAsStateWithLifecycle()
    LaunchedEffect(userId) { viewModel.load(userId) }
    ProfileScreen(uiState)
}

Notice the split: ProfileRoute connects to the ViewModel, and ProfileScreen just takes a ProfileUiState. The screen stays stateless and previewable, and you can test the ViewModel without Compose.

Which one to use

Where state lives Use it when
remember / rememberSaveable in the composable Only this composable cares about it (an expanded/collapsed flag, an animation)
Hoisted to a parent Siblings or the parent need to read or change it
Plain state holder class Several related values with UI logic, scoped to part of the UI
ViewModel Screen-level state, data from the data layer, or anything that must survive configuration changes

Side effects and when they run

A composable should only describe UI. It can run many times, in any order, and Compose may skip it entirely if its inputs didn’t change. So anything that reaches outside (starting a request, registering a listener, logging an analytics event) can’t go directly in the function body. That’s what effect handlers are for.

It helps to picture the lifecycle of a composable in three moments: it enters the composition, it recomposes zero or more times when the state it reads changes, and it leaves the composition. Effects hook into those moments.

LaunchedEffect: run suspend work while on screen

LaunchedEffect starts a coroutine when the composable enters the composition. If one of its keys changes, the running coroutine is cancelled and a new one starts. When the composable leaves, the coroutine is cancelled.

@Composable
fun SearchResults(query: String, onSearch: suspend (String) -> Unit) {
    LaunchedEffect(query) {
        delay(300) // debounce typing
        onSearch(query)
    }
}

Each keystroke changes query, which cancels the previous search and starts a new one 300 ms later. The analogy I like: lighting a candle when you enter a room. Change rooms (the key) and you blow it out and light a new one; leave and it’s blown out.

Pick keys carefully. LaunchedEffect(Unit) runs once per time the composable enters the composition. A key that changes on every recomposition restarts the effect constantly.

DisposableEffect: set up and clean up

DisposableEffect is for things that need cleanup: listeners, callbacks, observers. Its body runs on enter (and on key change), and its onDispose block runs on leave (and before re-running on key change).

@Composable
fun LifecycleLogger(lifecycleOwner: LifecycleOwner, onEvent: (Lifecycle.Event) -> Unit) {
    DisposableEffect(lifecycleOwner) {
        val observer = LifecycleEventObserver { _, event -> onEvent(event) }
        lifecycleOwner.lifecycle.addObserver(observer)
        onDispose {
            lifecycleOwner.lifecycle.removeObserver(observer)
        }
    }
}

Think of hotel housekeeping: the room is set up when you check in, and cleaned when you check out or switch rooms. onDispose is required, which is a nice guard against forgetting the cleanup.

SideEffect and rememberUpdatedState

SideEffect runs after every successful recomposition. Use it to push Compose state into something that isn’t Compose, like an analytics SDK’s current screen.

rememberUpdatedState solves a subtle problem: a long-running effect that captures a lambda keeps the first version of it. Wrap the value so the effect always sees the latest one without restarting:

@Composable
fun SplashScreen(onTimeout: () -> Unit) {
    val currentOnTimeout by rememberUpdatedState(onTimeout)
    LaunchedEffect(Unit) {
        delay(2_000)
        currentOnTimeout()
    }
}

The order, side by side

  Runs Re-runs Cleans up
Composable body On enter On recomposition, when state it reads changes When it leaves
LaunchedEffect(key) After entering When a key changes (old coroutine cancelled) Cancelled when it leaves
DisposableEffect(key) After entering When a key changes (onDispose first) onDispose when it leaves
SideEffect After each successful composition Every recomposition Nothing to clean up

Effects run after the composition is applied, never in the middle of it. So a composable’s body always runs before its effects, and an effect never sees a half-built UI.

A few rules of thumb

  • Keep composables as stateless as you can and hoist state to the lowest common parent.
  • Put logic in state holders or ViewModels, not in composable bodies.
  • Expose StateFlow from ViewModels and collect with collectAsStateWithLifecycle().
  • Never start work directly in a composable body. Use LaunchedEffect for suspend work and DisposableEffect for anything that needs cleanup.
  • Choose effect keys deliberately, and use rememberUpdatedState for callbacks inside long-lived effects.

Android’s guides on state and side effects go deeper. If you’re coming from React, my post on Jetpack Compose and React Native similarities maps useState and useEffect to the APIs above.


A Guide to Accessibility in Android Apps with Jetpack Compose

Accessibility on Android means making sure people can use your app with a screen reader, a switch device, voice commands, large fonts or magnification. Jetpack Compose makes most of this easier than the View system did, because accessibility information comes from semantics that the built-in components fill in for you. This guide covers how Android’s accessibility services see your UI, the Compose APIs that fix the common problems, and how to test for them.

It started as a talk. On November 28, 2024, I presented “Creating Inclusive Experiences: A Guide to Accessibility in Android Apps with Jetpack Compose” at The Test Tribe’s 12th Calgary meetup, hosted at the Neo Financial office. For the demos I built InaccessibleApp, a small app full of deliberate accessibility bugs, and fixed them live. This post folds in an earlier article I wrote on Android’s accessibility tools, so everything is in one place.

Why it matters

The World Health Organization estimates that about 1.3 billion people, roughly 1 in 6, live with a significant disability. Add temporary and situational limits (a broken wrist, bright sunlight, holding a baby in one arm) and accessible design helps far more people than it first seems. In many markets it’s also a legal requirement.

How users experience your app

Android ships several accessibility services. Each one reads the same information from your UI, so getting the semantics right fixes things for all of them at once.

  • TalkBack is the screen reader. Users swipe to move focus from element to element, TalkBack reads each one aloud, and a double tap activates it.
  • Select to Speak reads out whatever the user taps or selects.
  • Switch Access lets people navigate with one or more physical switches, a keyboard, or facial gestures through the front camera (Camera Switches) instead of touching the screen.
  • Voice Access lets users control the device by speaking, for example “tap Send”.
  • Font size, display size and high-contrast text change how your layout renders, which is where hard-coded sizes break.
  • Magnification lets users zoom into part of the screen with a triple tap or a shortcut.

The fastest way to understand all this is to turn on TalkBack and try to use your own app with your eyes closed. It’s humbling the first time.

A hand tapping a phone surrounded by icons for hearing, vision, mobility and touch accessibility

Semantics: what Compose tells accessibility services

Compose builds a semantics tree next to the UI tree. Each node describes what an element means: its text, its role (button, checkbox, heading), its state and the actions it supports. Accessibility services and UI tests both read this tree.

Components like Text, Button, Checkbox and Switch fill in their semantics automatically. Problems show up when you build custom components, use images, or compose small pieces into a bigger one. These are the fixes I use most.

Describe images and icons

Give meaningful images a contentDescription. Pass null for decorative ones so TalkBack skips them instead of reading “unlabelled image”.

Icon(
    imageVector = Icons.Default.Favorite,
    contentDescription = "Add to favourites"
)

Image(
    painter = painterResource(R.drawable.divider_wave),
    contentDescription = null // decorative
)

Don’t include the role in the description (“button”, “image”); TalkBack announces it already.

Explain what a click does

By default TalkBack says “double tap to activate”. A click label says what will actually happen:

Row(
    modifier = Modifier.clickable(
        onClickLabel = "Open article",
        onClick = { openArticle(article.id) }
    )
) {
    Text(article.title)
}

TalkBack now says “double tap to open article”.

Describe state

When a custom component has state, expose it. For anything that toggles, prefer Modifier.toggleable, which sets the state and role for you. For other states, set stateDescription:

Row(
    modifier = Modifier
        .toggleable(
            value = isSubscribed,
            role = Role.Switch,
            onValueChange = onSubscribedChange
        )
        .padding(16.dp)
) {
    Text("Weekly newsletter")
    Spacer(Modifier.weight(1f))
    Switch(checked = isSubscribed, onCheckedChange = null)
}

Setting onCheckedChange = null on the inner Switch matters: the whole row is the toggle, so the switch shouldn’t be a separate focus stop.

A list item made of an avatar, a name, a timestamp and a preview can turn into four separate TalkBack stops. Users have to swipe four times per item, and the pieces lose their context. Merge them so the item is read as one:

Row(modifier = Modifier.semantics(mergeDescendants = true) {}) {
    Avatar(user)
    Column {
        Text(user.name)
        Text(message.preview)
    }
}

Modifier.clickable and toggleable merge their children automatically, which is another reason to put the click on the container rather than on a child.

Mark headings

Screen reader users often jump between headings to skim a screen, the same way sighted users scan for bold text:

Text(
    text = "Recent orders",
    style = MaterialTheme.typography.titleLarge,
    modifier = Modifier.semantics { heading() }
)

Visual and motor accessibility

Semantics covers screen readers and switches. These rules cover everyone else:

  • Touch targets of at least 48×48 dp. Material components already enforce this. For custom clickable elements, add Modifier.minimumInteractiveComponentSize().
  • Contrast of at least 4.5:1 for normal text and 3:1 for large text and meaningful icons (WCAG AA). Don’t rely on colour alone to show errors or status; add an icon or text.
  • Use sp for text and let it grow. Test at the largest font size. Text that’s clipped or cut off with maxLines = 1 is the most common bug I see.
  • Avoid gestures as the only way to do something. Swipe-to-delete needs a visible alternative, because Switch Access and Voice Access users can’t easily swipe.
  • Respect animation settings for users who turn off animations.

Testing accessibility

I test in three layers:

  1. Manually with TalkBack. Nothing replaces moving through the real flow with a screen reader. Check the focus order, what gets read, and whether every action is reachable.
  2. With Accessibility Scanner. Google’s free app takes a screenshot and flags small touch targets, low contrast and missing labels.
  3. In automated UI tests. Compose tests find nodes through the same semantics tree, so finding a node by its content description is itself an accessibility check:
@Test
fun favouriteButton_isAccessible() {
    composeTestRule.setContent { ArticleScreen(article) }

    composeTestRule
        .onNodeWithContentDescription("Add to favourites")
        .assertHasClickAction()
        .assertIsDisplayed()
}

If you can’t find a button by its label in a test, TalkBack users can’t identify it either. Recent versions of the Compose testing library can also run Google’s Accessibility Test Framework checks automatically with enableAccessibilityChecks(), which catches contrast and touch-target issues as part of the normal test run.

Where to start

If your app has never had an accessibility pass, don’t try to fix everything at once. Turn on TalkBack, go through your most important flow (sign-in, checkout, the main screen) and fix what blocks you. Then add a label check to the tests for that flow so it stays fixed. If you’re still moving screens from XML to Compose, make accessibility part of each migrated screen; my guide to migrating from XML to Compose covers the rest of that process.

Android’s Compose accessibility guide covers the full semantics API, and the InaccessibleApp repository has the before-and-after examples from my talk.