# I Build with AI and so can you (Android Edition)

> Learn to build better android apps by collaborating with AI. Discover how to use PRDs, ADRs, and the Model Context Protocol (MCP) to guide AI to build exactly what you need.

- **Author**: Kartik Arora
- **Live Presentation**: https://presentations.kartikarora.me/i-build-with-ai-android/
- **Topics**: AI, Development, Android

---

## Slide 1: I Build with AI and so can you (Android Edition)

### I Build with AIand so can you(Android Edition)

Kartik Arora

Lead Engineer @

GDE Android

kartikarora.me

---

## Slide 2: Follow Along

### Follow Along

Presentation

presentations.kartikarora.me/i-build-with-ai-android

Codelab

codelabs.kartikarora.me/i-build-with-ai-android

---

## Slide 3: 2 Part Workshop

### 2 Part Workshop

- Part 1: Codelab with Gemini CLI

- Part 2: Hands-on in Android Studio (Panda 4 or newer)

---

## Slide 4: Let's begin Part 1

### Let's begin Part 1

Codelab with Gemini CLI

---

## Slide 5: Beyond the Buzzwords

### Beyond the Buzzwords

Before we build, let's &ldquo;demystify&rdquo; some terms I'm required to include in this presentation.

- LLM: Basically a spicy autocomplete that occasionally lies to you.

- RAG: When the AI doesn't know the answer, so it reads a PDF really fast.

- Agentic: Giving the AI a credit card and hoping for the best.

- MCP: A fancy way of saying &ldquo;the AI can finally see my files.&rdquo;

---

## Slide 6: Slide 6

&ldquo;Ask me relevant clarifying questions, one at a time&rdquo;

&mdash; Brett Morgan

---

## Slide 7: The End of Syntax

### The End of Syntax

Engineering is evolving from writing lines of code to orchestrating complex systems through high-level intent.

- The model generates the implementation.

- The engineer provides the architecture and constraints.

- Focus shifts from how to build it, to what to build.

---

## Slide 8: Why Structure Matters

### Why Structure Matters

It's not just prompting; it's about building a solid foundation where your AI partner really gets the vision of your project.

- Structure: The overarching rules, patterns and philosophy of a project.

- Intent: Translating high-level goals into functional, deterministic software.

- Reduces cognitive load by offloading syntax memorisation.

science

View this step in codelab

---

## Slide 9: What is a PRD?

### What is a PRD?

The Project Requirements Document (PRD) is the absolute Source of Truth for your AI Agent. If it's not in the PRD, it doesn't exist.

A good PRD should contain:

- Executive Summary & Goals

- Strict Technical Constraints (e.g., &ldquo;Kotlin & Compose only&rdquo;)

- Architecture & Spatial Logic

- Success Metrics

---

## Slide 10: Generating the DNA

### Generating the DNA

Don't worry, you don't have to write everything from scratch! You can brainstorm and build your PRD together through a friendly chat with Gemini.

Example Prompt:

```

Act as a Senior Android Architect.

Create a Product Requirements Document (PRD) for a "Note Taker" Android app and save it to `.gemini/prd/PRD.md`.

Ask me relevant clarifying questions, one at a time

```

Once generated, save it to .gemini/prd/PRD.md and lock it.

science

View this step in codelab

---

## Slide 11: Agent Instructions

### Agent Instructions

If the PRD is your project's heart, the agent instruction is its personality. It defines how your AI partner thinks, acts, and talks to you.

- Role: &ldquo;You are a hardcore Android UI purist.&rdquo;

- Action Rules: &ldquo;Always update files via tools, never output full files in chat.&rdquo;

- Tone: Concise, professional, no fluff.

---

## Slide 12: Setting the Standards

### Setting the Standards

The Agent file is where you enforce creative constraints. It prevents the AI from falling back on generic, "bootstrappy" designs.

By defining clear aesthetic principles like Visionary, Orchestral, Professional, the agent makes implicit micro-decisions about spacing, typography and animation curves without needing a prompt for every Material component.

Example Prompt:

```

Create an agent configuration for an AI coding assistant and save it to `.gemini/agents/android-specialist.md`.

Please ensure that the markdown file begins with the following frontmatter:

---

name: Android Specialist

description: A senior Android engineer specialising in Kotlin and Compose.

skills: [state-management]

prompt: "You are a Senior Android Engineer specialising in Kotlin and Jetpack Compose..."

version: 0.1.0

---

```

science

View this step in codelab

---

## Slide 13: What are Skills?

### What are Skills?

Skills are like handy little playbooks. They teach your AI exactly how to nail a specific task, just the way you like it!

- Stop repeating yourself in prompts.

- Ensure consistency across different projects.

- Create an organizational standard library.

---

## Slide 14: Making a Skill

### Making a Skill

A good skill document contains strict mandates, code examples, and prohibited patterns.

Example Prompt:

```

## Mandates

1. Always use StateFlow for ViewModels.

2. Update state atomically using `.update { ... }`.

## Prohibited

- Never use `MutableState` (Compose State) inside a ViewModel.

```

science

View this step in codelab

---

## Slide 15: Remote Skills

### Remote Skills

Skills don't have to live in your local repo. You can host them remotely and instruct the agent to fetch them.

Example: Fetching https://distribute.kartikarora.me/ai/BRAND-SKILL.1.5.0.md allows a single source of truth for a brand identity across an entire organization's AI tooling.

---

## Slide 16: Time to Build!

### Time to Build!

Now for the best part! We're going to use all those documents you just created to build your actual app. It's time to see your hard work pay off!

It's time to let the AI do the heavy lifting while you take the lead as the architect. This is where your vision truly becomes reality!

```

Build a note taker app following these documents:

PRD: @.gemini/prd/PRD.md

AGENT: @.gemini/agents/android-specialist.md

SKILL: @.gemini/skills/state-management.md

```

---

## Slide 17: Try it out!

### Try it out!

To run your app, we'll use Android Studio. It provides a pre-configured environment with everything you need.

- Open Android Studio.

- Open your project folder.

- Wait for Gradle to sync.

- Run the app!

science

View this step in codelab

---

## Slide 18: What is MCP?

### What is MCP?

The Model Context Protocol (MCP) is how AI agents interact with the outside world securely.

Instead of just generating text, an agent can use tools to:

- Read local files directly.

- Execute shell commands (safely).

- Query external APIs dynamically.

---

## Slide 19: Real-world Data

### Real-world Data

With MCP, your structured AI development isnt limited to what the model memorised in training.

You can tell the agent: &ldquo;Look at my open Github PR, read the feedback, and implement the requested changes in my local branch.&rdquo;

The context window becomes a dynamic workspace.

---

## Slide 20: Better Context with Context7

### Better Context with Context7

Context7 is an open-source MCP server by Upstash that brings the latest documentation and code examples directly to your AI.

The Challenge:

- AI assistants often rely on outdated training data.

- Deprecated APIs lead to hallucinations and broken code.

- Documentation for new library versions is missing.

---

## Slide 21: How it Works

### How it Works

By simply including &ldquo;use context7&rdquo; in your prompt, the agent fetches the most current documentation from source repositories.

- Up-to-date Info: Ensures the AI has current API signatures and patterns.

- Reduced Hallucinations: Accurate documentation means less fake or non-functional code.

- Version-Specific: Retrieve documentation for the exact library version you're using.

It covers thousands of popular libraries and frameworks instantly.

science

View this step in codelab

---

## Slide 22: End of Part 1

### End of Part 1

Let's take a break ☕

---

## Slide 23: Welcome back for Part 2

### Welcome back for Part 2

Gemini in Android Studio

---

## Slide 24: Gemini in Android Studio

### Gemini in Android Studio

Android Studio natively integrates Gemini to boost your productivity. It understands the context of your project.

- Code generation and autocompletion.

- Explaining complex code and analyzing crashes.

- Generating Compose UI from images.

Let's dive into some of the most powerful features.

---

## Slide 25: Agent mode

### Agent mode

The Agent mode allows you to prompt Gemini directly in Android Studio to make code edits across your project.

- Agentic capabilities: Allows Gemini to modify files and execute tasks on your behalf.

- Provide multi-step instructions and Gemini will propose the diffs.

- Review the changes in a familiar diff view before applying.

---

## Slide 26: Prompt Gallery

### Prompt Gallery

Save time by creating reusable prompts for common tasks.

- Standardise workflows: Create prompts for code review, documentation generation, or specific refactoring patterns.

- Share prompts with your team to ensure consistency.

- Quickly access them from the Gemini chat window.

---

## Slide 27: MCP Server Support

### MCP Server Support

Android Studio allows you to define a different harness for the Model Context Protocol.

- Connect Android Studio's Gemini to external data sources.

- Provide specific context tailored to your organisation's tools.

- Differs from the CLI approach by integrating directly into Android Studio's capabilities.

---

## Slide 28: Generate Unit Tests

### Generate Unit Tests

Writing tests can be tedious. Gemini can help you get started quickly.

- Right-click on a class or function and select AI > Generate Unit Tests.

- Gemini will analyse the code and create a suite of test cases.

- You can then refine and add specific edge cases.

---

## Slide 29: Generate UI from Image

### Generate UI from Image

Turn a mockup into code in seconds.

- Create an empty Kotlin file for the screen/component

- Open the file, right-click and select AI > Generate Code from Image.

- Upload the image and wait for the magic to happen!

---

## Slide 30: Generate Compose Previews

### Generate Compose Previews

Easily visualise your Composable functions without running the app.

- Gemini can automatically generate @Preview functions for your UI components.

- It will create sensible mock data to populate the preview.

- Saves time setting up repetitive preview configurations.

---

## Slide 31: Analyze Crashes

### Analyze Crashes

When your app crashes, Gemini can help you understand why.

- Click Fix with AI in the Logcat window.

- Gemini will analyse the stack trace and the relevant code.

- It will explain the cause of the crash and suggest potential fixes.

---

## Slide 32: Conclusion

### Conclusion

AI doesn't replace engineering; it amplifies it. By focusing on structure and intent, you're not just coding—you're architecting at a higher level.

- Architecture over Syntax: Define the system, let the model handle the boilerplate.

- Clear Intent: High-quality prompts lead to deterministic outcomes.

- MCP & Context: Give your agents the real-world data they need.

---

## Slide 33: The Future of Engineering

### The Future of Engineering

### &ldquo;Build with Intent. Lead with Structure.&rdquo;

The real magic of engineering is shifting from memorising syntax to creative problem solving and leading your AI team with a clear vision. You've got this!

---

## Slide 34: Dig Deeper

### Dig Deeper

Keep the momentum going with these great resources:

- Android Skills: github.com/android/skills

- Google Skills: github.com/google/skills

- MCP Protocol: modelcontextprotocol.io

- Context7: github.com/upstash/context7

- Gemini in Android Studio: developer.android.com/studio/gemini/features

Happy building!

---

## Slide 35: FIN.

### FIN.

Kartik Arora

Lead Engineer @

GDE Android

kartikarora.me

Questions?

---

