AI code completion

Studio Bot offers AI-enabled autocompletion of code in Android Studio that appears as gray italicized text as you type. We call this feature AI code completion. This feature saves you time and lets you complete coding projects faster by suggesting full functions. When AI code completion is enabled, Studio Bot might send additional information from your codebase such as surrounding pieces of your code, file types, and other necessary information to provide context to the LLM and provide more relevant suggestions.

Get started

To get started with AI code completion, follow these steps:

  1. Download the latest canary version of Android Studio Iguana.
  2. To launch Studio Bot, open or start an Android Studio project and click View > Tool Windows > Studio Bot.
  3. Sign in to your Google Account.
  4. AI code completion only works when Studio Bot can access context from your codebase. Enable this during Studio Bot sign-in or any time through Android Studio > Settings > Studio Bot > Augment responses with information from your codebase.
  5. Open a file and start typing. Suggestions only trigger when the cursor is at the end of a line or anywhere on a blank line.
  6. Press Tab to accept a suggestion and Esc to clear a suggestion.

FAQ

How do I get access to AI code completion?

This functionality only works when Studio Bot can access context from your codebase. Enable this through Android Studio > Settings > Studio Bot > Augment responses with information from your codebase. AI-enabled autocompletion appears as you type. You can also use natural language comments to trigger code completions by adding comments.

Why am I not able to see a code completion?

First, check that you're logged in to Studio Bot and have opted in to AI code completion at Android Studio > Settings > Studio Bot. Keep in mind that the system won't always generate code completions. It's possible that the model doesn't have enough information to generate a response with high confidence.

How can I turn off AI code completion in Android Studio?

To disable AI code completion, go to Android Studio > Settings > Studio Bot and revoke consent and turn off AI code completion.