Android Studio has always been a capable IDE, but for years it lacked the kind of AI-powered coding assistance that Visual Studio Code users enjoyed through GitHub Copilot. That changed when Google introduced Gemini Code Assist directly into Android Studio. Unlike third-party extensions that bolt AI onto an editor, Gemini Code Assist is a first-party feature built by the same team that makes the IDE itself. The integration is tight, the setup is minimal, and the free tier is generous enough for most individual developers.
This matters particularly for Flutter developers. Android Studio remains the primary IDE for Flutter development — it offers the best widget inspector, the most reliable hot reload, and deeper integration with the Android and iOS build toolchains than any alternative. Having a capable AI assistant built directly into that environment, rather than needing to switch to VS Code for AI features, is a meaningful productivity gain. Kotlin developers benefit equally, since Gemini understands Kotlin idioms, Jetpack Compose patterns, and Gradle configuration at a level that general-purpose AI tools often struggle with.
I have been using Gemini Code Assist in Android Studio across several Flutter and Kotlin projects over the past few months. This guide covers everything from initial setup to advanced workflows, with an honest assessment of where it excels and where it falls short.
Prerequisites
Before you can use Gemini Code Assist, you need the following:
- Android Studio Ladybug (2024.2.1) or later. Gemini Code Assist is not available in older versions. If you are running an earlier release, update through Help > Check for Updates on Windows/Linux or Android Studio > Check for Updates on macOS. The Ladybug release was the first to ship with Gemini integration built in, and subsequent releases have continued to improve the feature set.
- A Google account. Gemini Code Assist requires you to sign in with a Google account. The free tier provides a generous number of completions and chat interactions per day — more than enough for individual development work. If your organisation uses Google Cloud, you may have access to the enterprise tier with higher rate limits and additional features like code customisation based on your private repositories.
- An active internet connection. Unlike local AI models, Gemini Code Assist processes requests in the cloud. Your code snippets are sent to Google's servers for inference. Google states that free-tier code snippets are not used to train models, but if your organisation has strict data residency or intellectual property policies, verify compliance before enabling the feature.
- Flutter SDK (for Flutter projects). If you are using Gemini Code Assist for Flutter development, ensure the Flutter SDK is installed and configured in Android Studio. Go to File > Settings > Languages & Frameworks > Flutter and verify the SDK path is set correctly.
Enabling Gemini Code Assist
If you have a fresh installation of Android Studio Ladybug or later, Gemini Code Assist may already be partially enabled. Here is how to ensure everything is configured correctly:
- Sign in to your Google account. Look for the Gemini icon in the right-hand tool window bar (it resembles a sparkle or star shape). Click it, and you will be prompted to sign in. If you do not see the icon, go to View > Tool Windows > Gemini to activate the panel.
- Accept the terms of service. On first use, Google presents a terms of service screen explaining how your code is processed. Read through this carefully — it explains what data is sent, how it is used, and the difference between free and enterprise tier data handling.
- Enable inline code completions. Navigate to File > Settings > Tools > Gemini. Ensure "Enable Gemini" is ticked. Under code completion settings, enable "AI code completions" if it is not already active. You can also toggle whether completions appear automatically as you type or only when explicitly triggered.
- Configure completion behaviour. In the same settings panel, you can control how aggressively Gemini suggests code. I recommend leaving it on the default "Automatic" setting initially and adjusting if you find the suggestions distracting. You can also configure whether Gemini provides single-line or multi-line completions.
- Verify the connection. Open the Gemini panel (the sparkle icon in the sidebar) and type a simple question like "What version of Gemini are you?" If you get a response, the connection is working. If you see an error about authentication or network connectivity, check that your Google account is signed in and that your firewall is not blocking connections to Google's API endpoints.
The entire setup takes under two minutes. This is one of Gemini Code Assist's strongest advantages over third-party alternatives — there is no extension to install, no API key to manage, and no configuration file to edit. It works out of the box once you sign in.
Inline Code Completions
Inline code completions are the feature you will interact with most frequently. As you type, Gemini analyses the context of your current file — the imports, class structure, function signatures, and the code immediately surrounding your cursor — and suggests what you are likely to type next. Suggestions appear as greyed-out text that you accept by pressing Tab or reject by continuing to type.
How Completions Work for Kotlin
Gemini's Kotlin completions are notably strong. It understands Kotlin idioms like scope functions (let, apply, run, with, also), extension functions, data classes, and sealed classes. When you start writing a when expression on a sealed class, Gemini often suggests all the branches automatically, including the else clause. For Jetpack Compose code, it recognises composable function patterns and suggests appropriate modifiers, layout structures, and state management patterns.
Where Kotlin completions excel is in boilerplate reduction. Writing a Room database entity, a Retrofit service interface, or a ViewModel with LiveData — Gemini handles all of these with minimal prompting. Type the annotation and the class name, and it fills in the rest based on your existing project patterns.
How Completions Work for Dart and Flutter
For Flutter developers, Gemini's Dart completions cover widget trees, state management patterns, and common Flutter APIs. Start typing a Scaffold and Gemini suggests the appBar, body, and floatingActionButton properties with sensible defaults. Begin a StatefulWidget declaration and it generates the companion State class with the build method scaffolded.
The completions are context-aware within the widget tree. If you are inside a Column and start adding children, Gemini suggests widgets that make sense in that context — Text, SizedBox for spacing, Padding, and so on. It also respects your existing import statements and suggests classes from packages you have already imported rather than defaulting to the most common option from the standard library.
Accepting and Rejecting Suggestions
Press Tab to accept a suggestion in full. If the suggestion is partially correct, you can press Ctrl+Right Arrow (or Cmd+Right Arrow on macOS) to accept it word by word — useful when the first part of the suggestion is right but the end needs adjustment. Press Escape to dismiss a suggestion entirely. If you simply continue typing, the suggestion disappears and a new one may appear based on what you typed.
Chat-Based Coding
The Gemini panel in the sidebar is a full-featured chat interface where you can ask questions, request code generation, and get explanations — all within the context of your current project.
Code Explanation
Select any block of code in your editor, right-click, and choose Gemini > Explain this code. The explanation appears in the Gemini panel with a clear breakdown of what the code does, step by step. This is particularly useful when working with inherited codebases or reviewing pull requests from team members. Gemini handles complex Kotlin constructs like coroutine flows, channel operations, and generic type constraints well, providing explanations that are accurate and appropriately detailed.
Refactoring Assistance
Highlight a function or class and ask Gemini to refactor it. You can be specific: "Refactor this function to use Kotlin coroutines instead of callbacks" or "Convert this StatefulWidget to use Riverpod for state management." Gemini generates the refactored code and explains the changes it made. You can then copy the result into your editor or use the "Insert at cursor" button to place it directly.
Test Generation
Ask Gemini to write tests for a specific function or class. For Kotlin, it generates JUnit tests with appropriate assertions, mock objects (using Mockito or MockK depending on what your project already imports), and test lifecycle methods. For Flutter, it generates widget tests with WidgetTester and unit tests with expect matchers. The generated tests cover the main paths well, though you should review edge cases and add boundary condition tests manually.
Flutter-Specific Workflows
Gemini Code Assist is especially valuable for Flutter development because Android Studio is where most Flutter developers already work. Here are the workflows I find most useful.
Widget Generation
Describe a UI component in the Gemini chat and it generates the corresponding widget tree. For example, type "Create a product card widget with an image at the top, a title, price, and an 'Add to Cart' button at the bottom. Use Material 3 styling." Gemini produces a complete StatelessWidget with appropriate layout widgets, text styles, and a button with an onPressed callback parameter. The generated code follows Flutter conventions — it uses const constructors where possible, applies EdgeInsets for padding, and structures the widget tree in a readable way.
For more complex widgets, break the request into parts. Ask for the layout structure first, then request specific customisations like animations, gesture detection, or responsive behaviour. Gemini handles iterative refinement well — it remembers the context of the conversation and builds on previous responses.
State Management Boilerplate
State management in Flutter involves significant boilerplate, regardless of which solution you use. Gemini can generate the scaffolding for all the major approaches:
- Riverpod: Ask for a
StateNotifierProviderwith specific state fields and methods. Gemini generates the provider, the state notifier class, and the state class withcopyWithmethods. - BLoC: Request a BLoC for a specific feature, and Gemini generates the event classes, state classes, and the BLoC itself with
on<Event>handlers. It follows the standard BLoC naming conventions and includes theEquatablemixin where appropriate. - Provider: For simpler state management needs, ask for a
ChangeNotifierwith specific properties and notification logic.
The time savings here are substantial. A Riverpod state notifier with five state fields, a loading state, an error state, and three methods takes perhaps ten minutes to write by hand. Gemini generates a working version in seconds, and you spend a minute or two reviewing and customising it.
build.gradle and pubspec.yaml Assistance
Configuration files are a persistent source of frustration in Flutter development. Gemini understands both build.gradle (for Android-specific configuration) and pubspec.yaml (for Flutter dependencies and assets). Ask questions like "How do I configure ProGuard rules for this Flutter project?" or "What do I add to pubspec.yaml to use the google_fonts package with specific font families?" and Gemini provides the exact configuration snippets you need, including version numbers that are current as of its training data.
For build.gradle specifically, Gemini handles the Kotlin DSL and Groovy DSL equally well. If your project uses the newer Kotlin-based Gradle configuration, it generates build.gradle.kts syntax. If you are on the older Groovy-based files, it matches that style instead. This context sensitivity saves time that would otherwise be spent translating between the two formats.
Kotlin-Specific Workflows
For native Android development with Kotlin, Gemini Code Assist leverages its deep understanding of the Android SDK, Jetpack libraries, and Kotlin language features.
Compose UI Generation
Jetpack Compose development benefits enormously from AI assistance because of the amount of boilerplate involved in creating custom layouts, themes, and animations. Describe a screen layout to Gemini and it generates composable functions with appropriate modifiers, state hoisting, and preview annotations. For example: "Create a login screen with email and password fields, a 'Remember me' checkbox, a login button, and a 'Forgot password' text link. Follow Material 3 guidelines." Gemini produces a complete composable with TextField components, proper state management using remember and mutableStateOf, input validation, and theming that respects your app's MaterialTheme.
It also handles Compose-specific patterns like LaunchedEffect, derivedStateOf, and custom Modifier extensions. If you ask it to add a shimmer loading effect to a list item, it generates the animation code with InfiniteTransition and appropriate Brush configurations.
Coroutine Patterns
Kotlin coroutines are powerful but have a steep learning curve, particularly around structured concurrency, exception handling, and flow operators. Gemini is a reliable guide here. Ask it to "Convert this callback-based API call to use coroutines with proper error handling" and it generates code with withContext(Dispatchers.IO), try-catch blocks, and appropriate scope management. It understands the difference between launch and async, knows when to use supervisorScope, and correctly applies flowOn for flow-based operations.
For ViewModels specifically, Gemini generates coroutine code that uses viewModelScope correctly, handles cancellation gracefully, and exposes results through StateFlow or SharedFlow rather than the deprecated LiveData patterns.
Gradle Configuration
Gradle configuration for Android projects is notoriously complex, especially with the migration to version catalogues and the Kotlin DSL. Gemini handles questions about dependency management, build variants, flavour dimensions, signing configurations, and ProGuard rules. If you are migrating from the older buildscript block to the newer plugins DSL, Gemini can generate the equivalent configuration. It also understands version catalogue files (libs.versions.toml) and can help you add new dependencies in the correct format.
Code Transformations and Refactoring
Beyond generating new code, Gemini Code Assist excels at transforming existing code. Here are the most useful transformation workflows.
Rename and Restructure
While Android Studio has built-in rename refactoring (Shift+F6), Gemini handles more complex restructuring. Ask it to "Rename this class from UserManager to UserRepository and update all method names to follow the repository pattern." It generates the transformed code with method names changed from imperative style (saveUser, deleteUser) to repository style (insert, delete, getById, getAll). You can then review the changes and apply them.
Extract and Decompose
Select a long function and ask Gemini to "Extract this into smaller, single-responsibility functions." It analyses the logic, identifies natural boundaries, and suggests a decomposition with appropriately named helper functions. For Flutter widget trees, this is particularly valuable — ask it to "Extract the form section of this widget into a separate widget class" and it creates a new widget with the correct constructor parameters and callback functions to maintain communication with the parent.
Pattern Migration
Gemini handles common migration patterns well. Ask it to migrate a class from one approach to another — for example, "Convert this class from using SharedPreferences directly to using DataStore" or "Migrate this navigation code from Navigator 1.0 to GoRouter." It generates the transformed code with appropriate imports, configuration, and usage patterns for the target approach.
Gemini Code Assist vs GitHub Copilot in Android Studio
GitHub Copilot is also available in Android Studio through the JetBrains plugin. Here is how the two compare based on my experience using both.
| Feature | Gemini Code Assist | GitHub Copilot |
|---|---|---|
| Integration depth | Native, first-party — built into the IDE | Third-party plugin |
| Setup effort | Minimal — sign in with Google account | Install plugin, sign in with GitHub |
| Inline completion quality | Very good for Kotlin and Dart | Excellent across all languages |
| Flutter/Dart support | Strong — understands widget patterns | Good — slightly less Flutter-specific |
| Kotlin/Compose support | Excellent — deep Android SDK knowledge | Very good |
| Chat interface | Built-in panel with project context | Copilot Chat panel (requires separate enablement) |
| Gradle/build config help | Strong — understands Android build system | Adequate — sometimes outdated suggestions |
| Free tier | Yes — generous daily limits | Free tier available with limited completions |
| Paid tier | Google Cloud subscription for enterprise | $19/month individual, $39/month business |
| Privacy | Cloud-based — code sent to Google | Cloud-based — code sent to GitHub/Microsoft |
| Offline availability | No | No |
| Multi-language breadth | Strong in Android ecosystem languages | Strong across all languages |
The practical takeaway: if you primarily work in Android Studio with Kotlin and Flutter, Gemini Code Assist is the better choice. Its understanding of the Android ecosystem is deeper, the integration is smoother, and the free tier is more generous. If you work across multiple IDEs and languages, Copilot's broader coverage and consistent experience across editors may be worth the subscription. There is nothing stopping you from using both simultaneously — Copilot for general completions and Gemini for Android-specific chat queries.
Limitations
Gemini Code Assist is a capable tool, but it has clear limitations you should be aware of.
- No offline mode. Every request requires an internet connection. If you work in environments with restricted or unreliable connectivity, this is a non-starter. For offline AI assistance, consider a local model setup with Ollama instead.
- Context window limitations. Gemini analyses your current file and some surrounding context, but it does not index your entire project the way some enterprise AI tools do. If you ask it a question about how two distant modules interact, it may not have enough context to answer accurately. Providing relevant code snippets in the chat helps bridge this gap.
- Accuracy varies with complexity. For straightforward tasks — generating boilerplate, writing standard patterns, explaining common APIs — Gemini is reliable. For complex architectural decisions, subtle concurrency bugs, or niche library interactions, its suggestions should be treated as starting points rather than final answers. Always review generated code before committing it.
- Rate limits on the free tier. While the free tier is generous for individual use, heavy usage during intense coding sessions can hit the daily limit. If you find yourself running out of completions regularly, the enterprise tier removes these restrictions.
- Training data freshness. Like all AI models, Gemini's knowledge has a cutoff date. Very new libraries, recent API changes, or newly released Flutter/Kotlin features may not be reflected in its suggestions. Always verify version-specific syntax against the official documentation.
- Not a replacement for understanding. The convenience of AI-generated code can tempt developers — especially those early in their careers — to accept suggestions without fully understanding them. Use Gemini to accelerate your workflow, not to bypass learning. If it generates a coroutine pattern you do not recognise, ask it to explain before you use it.
Frequently Asked Questions
Is Gemini Code Assist free in Android Studio?
Yes. Google provides a free tier of Gemini Code Assist for individual developers. It includes inline code completions, chat-based assistance, and code generation with a daily usage limit. For most individual developers working on personal or small-team projects, the free tier is sufficient. The enterprise tier, available through Google Cloud subscriptions, offers higher rate limits, code customisation based on your private repositories, and administrative controls for organisations. If you are working on a team project and find the free tier limits restrictive, talk to your organisation about the enterprise option.
Does Gemini Code Assist work well with Flutter projects?
Yes, and this is one of its strengths. Because Google maintains both Flutter and Gemini, the AI has deep knowledge of Flutter's widget system, state management patterns, and common packages. It generates clean widget trees, understands the difference between StatelessWidget and StatefulWidget usage, and produces idiomatic Dart code. It is particularly useful for generating boilerplate — state management classes, model classes with serialisation, and test scaffolding. The quality of Flutter-specific suggestions in Gemini Code Assist is noticeably better than what you get from general-purpose AI tools that treat Dart as just another language.
Can I use Gemini Code Assist alongside GitHub Copilot?
Yes, both can be active simultaneously in Android Studio. In practice, you may experience occasional conflicts with inline completions if both tools try to suggest code at the same time. A practical approach is to use Gemini for inline completions (since it has stronger Android-specific context) and Copilot for its chat features if you prefer the Copilot Chat interface. Alternatively, disable inline completions in one tool and rely on it only for chat. I have found that using Gemini as the primary assistant and keeping Copilot as a secondary reference works well — if Gemini's suggestion does not look right, I can quickly check what Copilot suggests.
Sources and Further Reading
- Google — Gemini in Android Studio documentation
- Google Cloud — Gemini Code Assist overview
- Android Studio — official download and release notes
- Flutter — official documentation
- GitHub Copilot
Related Posts
- Create With AI: Building Flutter Apps Using AI Assistants
- Flutter App Architecture in 2026: Best Practices and Patterns
- Flutter State Management: Choosing the Right Solution for Your Project
Want to use AI tools more effectively?
My courses cover practical AI workflows, from spreadsheet formulas to app development, with real projects and honest tool comparisons.
Browse all courses