Stay organized with collections
Save and categorize content based on your preferences.
Gemini offers AI-enabled autocompletion of code in Android Studio that appears
as gray italicized text as you type. This feature saves you time and lets you
complete coding projects faster by suggesting full functions. When AI code
completion is enabled, Gemini 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.
To use AI code completion, follow these steps:
Enable context sharing by selecting Use all Gemini features in the
Gemini settings. AI code
completion only works when Gemini can access context from your codebase.
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.
Press Tab to accept a suggestion and Esc to clear a
suggestion.
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.
You can toggle AI code completion on and off at any time by clicking the Gemini
icon at the bottom of the Studio IDE
and clicking Enable AI code completion.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-07-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-31 UTC."],[],[],null,["# Accelerate coding with AI code completion\n\nGemini offers AI-enabled autocompletion of code in Android Studio that appears\nas gray italicized text as you type. This feature saves you time and lets you\ncomplete coding projects faster by suggesting full functions. When AI code\ncompletion is enabled, Gemini might send additional information from your\ncodebase such as surrounding pieces of your code, file types, and other\nnecessary information to provide context to the LLM and provide more relevant\nsuggestions.\n\nTo use AI code completion, follow these steps:\n\n1. Enable context sharing by selecting **Use all Gemini features** in the [Gemini settings](/studio/gemini/configure-gemini). AI code completion only works when Gemini can access context from your codebase.\n2. 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.\n3. Press \u003ckbd\u003eTab\u003c/kbd\u003e to accept a suggestion and \u003ckbd\u003eEsc\u003c/kbd\u003e to clear a suggestion.\n\nKeep in mind that the system won't always generate code completions. It's\npossible that the model doesn't have enough information to generate a response\nwith high confidence.\n\nYou can toggle AI code completion on and off at any time by clicking the Gemini\nicon at the bottom of the Studio IDE\n\nand clicking **Enable AI code completion**."]]