Ravindra BagaleCourses & study guides Track your progress
AI CODING ASSISTANTS · CHAPTER 2 · SETUP

How to Set Up GitHub Copilot in Android Studio (Step by Step)

Android Studio is Google's IDE for Android apps. It is built on IntelliJ, so GitHub Copilot works there through the same JetBrains plugin. Android Studio also has Google's own Gemini assistant built in.

In short: Settings → Plugins → Marketplace → GitHub Copilot (publisher GitHub) → Restart → Tools → GitHub Copilot → Login to GitHub → device code.

Why Copilot in Android Studio

WHY

Android apps need a lot of repeated code: layouts, view models, adapters, tests. Copilot writes that fast in Kotlin. If your team already uses Copilot in other IDEs, the same account and rules work here.

What you need

WHAT
  • Android Studio: keep it updated. The Marketplace only offers Copilot builds that fit your version.
  • GitHub account with Copilot: Copilot Free or a paid plan.
  • GitHub Copilot plugin: the same JetBrains plugin as IntelliJ. There is no separate Android build.
  • Gemini in Android Studio: Google's built-in assistant. It is a different product. Its “Agent Mode” is not Copilot's agent mode.

How setup flows

1 · Plugins → Marketplace search GitHub Copilot 2 · Check publisher GitHub, then Install 3 · Restart IDE click Restart 4 · Login to GitHub Tools → GitHub Copilot 5 · Device code paste, Authorize

Install steps

HOW
  1. Open Android Studio → Settings (Mac: Android Studio → Settings) → Plugins.
  2. Open Marketplace, search GitHub Copilot. Check the publisher is GitHub. Click Install.
  3. Click Restart IDE.
  4. Open Tools → GitHub Copilot → Login to GitHub.
  5. Click Copy and Open, paste the device code in the browser, click Continue.
  6. Click Authorize GitHub Copilot Plugin, then OK in Android Studio.

Settings

  1. Completions: Copilot icon in the status bar → pause or turn off per language.
  2. Chat: the GitHub Copilot Chat tool window. Pick Ask or Agent mode, and a model.
  3. Two assistants? If Gemini and Copilot both show inline suggestions, turn off inline completions in one of them to avoid clashes.
  4. Plugin errors after an Android Studio update: update the plugin; a brand-new Studio build can arrive before the plugin supports it.

Configuration

  1. Add .github/copilot-instructions.md: “Kotlin, Jetpack Compose, ViewModel + StateFlow, JUnit tests, no hard-coded API keys.”
  2. Keep API keys in local.properties (not committed) or a secrets plugin, never in source.
.github/copilot-instructions.md
# Rules for Copilot (Android)
- Kotlin only, Jetpack Compose for UI
- ViewModel + StateFlow, no logic in Composables
- Unit tests with JUnit for every ViewModel
- Never hard-code API keys

First task (5 minutes)

  1. Open a Kotlin file. Type // EMI for principal, annual rate %, months and start fun emi(. Press Tab to accept.
  2. In Copilot Chat ask: “Write unit tests for emi, including zero interest.”
  3. Run the tests with the green arrow. See the tested EMI example in Code in Kotlin using AI.
Rule: do not paste production keystores, signing passwords or customer data into any chat.

Quick quiz

1. Is there a separate Copilot plugin for Android Studio?

No. It uses the same JetBrains GitHub Copilot plugin.

2. How do you log in after installing?

Tools → GitHub Copilot → Login to GitHub, then the device code.

3. Is Gemini's Agent Mode the same as Copilot's agent mode?

No. They are different products from different companies.

4. Where should Android API keys live?

In local.properties (not committed) or a secrets setup, never in source code.

Save tokens and money

SMART AI USE

Use inline completion for Compose boilerplate; it is the cheapest. Ask chat about one file at a time. Do not paste whole Gradle build logs, only the error lines.

Save these cards

INTERVIEW CARDAI Coding

How to set up Copilot in Android Studio?

Plugins → Marketplace → GitHub Copilot → Restart.
Tools → GitHub Copilot → Login → device code.
Ravindra Bagale · ravindrabagale.com/ai-coding
COMPARISON CARDAI Coding

Copilot vs Gemini in Android Studio

Copilot: GitHub plugin, GitHub account.
Gemini: built in by Google, Google account.
Ravindra Bagale · ravindrabagale.com/ai-coding
REVISION CARDAI Coding

Android setup in 4

Install plugin (publisher GitHub) → Restart.
Login with device code.
Rules file; keys in local.properties.
Ravindra Bagale · ravindrabagale.com/ai-coding