Refactoring and documentation

Gemini in Android Studio streamlines your workflow and makes it easier to keep your code organized with AI-powered refactoring and documentation features.

Generate documentation

You can use Gemini in Android Studio to generate documentation for your code. Generate clear and concise documentation for your code with instant drafts that you can refine and perfect.

  1. Select a code snippet and right-click in the code editor and select Gemini > Document Function from the context menu. (You may also see Document Class… or Document Property… depending on the context.)
  2. Review proposed changes and refine if necessary before you click Accept changes.
Gemini AI powered documentation
Gemini can suggest documentation for your code.

Rename with Gemini

When using the standard Refactor > Rename action renaming variables, classes, and methods, Gemini suggests appropriate names based on the code context.

The Code Editor's Rename Local Variables dialog with name
          suggestions.
Gemini can suggest names for classes, methods, and variables.

Rethink variable names

Gemini can suggest names for all variables or methods in a file based on the code context, so that names are more intuitive and descriptive. Right-click in the code editor and select Gemini > Rethink variable names. A dialog appears where you can review the suggested names and accept only the ones you like.

The Code Editor's Rename Local Variables dialog with alternative
         name suggestions.
Gemini can suggest alternative names for variables in a file.

Suggest commit message

When committing changes to your version control system from the IDE, Gemini can use the context from the code changes in the current commit and recent past commits to suggest a detailed commit message. To generate a commit message, click the Suggest commit message button above the text input field in the Commit tool window.

Commit dialog showing a suggested message for the commit.
Gemini can suggest a detailed message for your commit.