Cross-platform development has become the standard for creating mobile applications that work equally well on both Flutter has become the standard for creating mobile applications that work equally well on Android and iOS. However, many developers encounter difficulties already at the stage of setting up the environment - especially when it comes to integration Flutter SDK c Android Studio. This article will not only tell you how to add Flutter to Android Studio, but also explain why each step is important, what pitfalls can arise, and how to avoid them.

If you are switching from native development to Kotlin/Java or are just starting out in mobile development, this guide will help save you hours of searching for solutions to common mistakes. We will consider not only the basic installation, but also optimization Android Studio for working with Flutter, setting up emulators, and even the nuances of working with pubspec.yaml. And at the end - answers to the most common questions that beginners have.

1. Checking system requirements before installing Flutter

Before downloading Flutter SDK, make sure your system meets the minimum requirements. This will eliminate errors at the installation stage and save time.

To work with Flutter v Android Studio you need:

  • ๐Ÿ–ฅ๏ธ Operating system: Windows 10/11 (64-bit), macOS (x86_64 or ARM), or Linux (64-bit). Support Windows 7/8 officially discontinued.
  • ๐Ÿ’พ Free disk space: no less 2.8 GB (excluding Android SDK i emulators). Recommended 10+ GB for comfortable work.
  • ๐Ÿ”ง Development tools: Git (for version control), Android Studio 2022.3+ (or IntelliJ IDEA with plugins).
  • ๐Ÿ“ฑ Device for testing: physical Android smartphone with software debugging enabled USB or emulator (Android Virtual Device).

Flutter does not support 32-bit systems and virtual machines without hardware acceleration (for example, VirtualBox without Hyper-V enabled). If you use macOS on Apple Silicon (M1/M2), you will need additional configuration to work with Android Emulator.

โš ๏ธ Attention: Hardware and software requirements may change with the release of new versions FlutterBefore installation, check the current conditions on official website.
๐Ÿ“Š Which Are you planning to develop an OS using Flutter?
Windows
macOS
Linux
I donโ€™t know

2. Installing the Flutter SDK: step-by-step guide

Downloading and installing Flutter SDK โ€”the first critical stage. Errors here will lead to problems with dependencies and building projects.

Follow this algorithm:

  1. Download the archive from the Flutter SDK s official website. Select the version for your OS (stable channel recommended for beginners).
  2. Unpack the archive to a folder without spaces and Cyrillic characters in the path (for example, C:\src\flutter or /Users/yourname/development/flutter).
  3. Add Flutter to the environment variable PATH:
    • ๐ŸชŸ Windows: Control Panel โ†’ System โ†’ Advanced system settings โ†’ Environment variables โ†’ add the path to flutter\bin.
    • ๐ŸŽ macOS/Linux: add a line to ~/.bashrc or ~/.zshrc:
      export PATH="$PATH:[PATH_TO_FLUTTER]/flutter/bin"
  • Check installation command in the terminal:
    flutter doctor

    It will show which components are configured correctly and which require attention.

  • If flutter doctor produces errors related to Android Licensefollow:

    flutter doctor --android-licenses

    and agree to all license agreements (click y for each item).

    โ˜‘๏ธ Checking Flutter installation

    Completed: 0 / 4

    3. Setting up Android Studio to work with Flutter

    Android Studio is the main tool for development on Flutter, but by default it is not configured to work with it framework. You will need:

    Install plugins:

    1. Open Android Studio โ†’ go to File โ†’ Settings โ†’ Plugins (or Android Studio โ†’ Preferences โ†’ Plugins to macOS).
    2. Find and install two plugins:
      • ๐Ÿ”ง Flutter โ€”the main plugin to support the framework.
      • ๐Ÿ“ฑ Dart โ€”the programming language in which Flutter applications are written.
  • Restart Android Studio after installation.
  • Create a new Flutter project:

    1. In the start window, select New Flutter Project.
    2. Specify the project type - for example, Flutter Application.
    3. Specify the project name (without spaces or special characters), the path to save and click Finish.
    4. If an error occurs when creating a project "Flutter SDK not found", check:

      • ๐Ÿ“ Is the path to correct? data-i="130">in settings Flutter SDK in settings Android Studio (File โ†’ Settings โ†’ Languages & Frameworks โ†’ Flutter).
      • ๐Ÿ”„ Restart Android Studio after changing the path.
    ๐Ÿ’ก

    If Android Studio takes a long time to index the project after creation, open File โ†’ Invalidate Caches / Restart โ€”this will speed up the process.

    4. Setting up an Android emulator for testing Flutter applications

    Without an emulator or a physical device, you will not be able to test your application. Flutter requires Android Emulator with support x86_64 or ARM.

    How to create a virtual device:

    1. Open AVD Manager to Android Studio (icon in the form of a phone with a plus).
    2. Click Create Virtual Device โ†’ select a model (for example, Pixel 5).
    3. Download the system image (Android 13+ recommended for the latest versions Flutter).
    4. Configure the emulator parameters:
      • ๐Ÿ–ฅ๏ธ RAM: minimum 2 GB (optimally 4 GB).
      • ๐Ÿ’พ Internal Storage: 8 GB is enough for most projects.
      • ๐Ÿ”„ Graphics: Hardware - GLES 2.0 for better performance.

    Common problems with the emulator and their solutions:

    Problem Cause Solution
    The emulator does not start Not enough memory or hardware acceleration is not enabled Increase RAM in the AVD settings or enable Hyper-V (Windows)/HAXM (macOS)
    The application does not install on the emulator Incompatible version Android or Flutter SDK Update Flutter (flutter upgrade) or create an AVD with a newer version Android
    The emulator is slow Low PC performance or turned on Software Rendering Use Hardware Acceleration and close other resource-intensive apps
    โš ๏ธ Attention: On macOS with Apple Silicon chip (M1/M2) standard Android Emulator does not work. Use alternatives: Android Studio Arctic Fox+ with support for ARMemulators or a physical device.

    5. First launch of a Flutter project: debugging and common errors

    After setting up the environment, the moment of truth has come - launching the first project. Even if everything is configured correctly, unexpected errors may occur.

    How to run the project:

    1. Open the file main.dart in Android Studio.
    2. Select the target device (emulator or physical) in the top panel.
    3. Press the green button Run (or Shift + F10).
    4. Typical errors and their solutions:

      • ๐Ÿšจ "No devices available":
        • Check if the emulator is running (AVD Manager).
        • For a physical device, enable USB Debugging in Settings โ†’ For developers.
      • ๐Ÿšจ "Flutter plugin not installed":
        • Reinstall the plugins Flutter in Dart in Android Studio.
        • Check that the path to Flutter SDK specified correctly in the settings.
      • ๐Ÿšจ "Gradle build failed":
        • Update Gradle in the file android/gradle/wrapper/gradle-wrapper.properties (the current version is indicated in Gradle documentation).
        • Run flutter clean and rebuild the project.

      If the application starts but displays a white screen, check:

      • ๐Ÿ“ Correctness of the code in main.dart (there must be a widget MaterialApp).
      • ๐Ÿ” Logs in the console Android Studio (Run โ†’ Debug).
      ๐Ÿ’ก

      If the project is not built, always run flutter clean i first - this solves 80% of dependency problems. flutter pub get - this solves 80% of dependency problems.

      6. Optimizing Android Studio for convenient work with Flutter

      By default Android Studio is not optimized for Flutter. Several settings will significantly speed up development:

      Useful settings:

      • โšก Enable Hot Reload:
        • Keyboard shortcut: Ctrl + S (save) + R in the terminal console.
        • Or button Hot Reload in the top panel (icon with lightning).
      • ๐Ÿ” Configure Dart Analysis:
        • Go to File โ†’ Settings โ†’ Editor โ†’ Inspections.
        • Disable unnecessary warnings (for example, "Unused import" for test files).
      • ๐Ÿ“ Use .gitignore:
        • Add to the file:
          /.dart_tool/
          

          /build/

          /android/.gradle/

          /android/local.properties

      Recommended plugins for Flutter development:

      Plugin Purpose Installation link
      Flutter Intl Automatic generation of localizations (i18n) Marketplace in Android Studio
      Dart Data Class Generator Generation of class templates using JSON Marketplace in Android Studio
      Rainbow CSV Color marking CSVfiles (useful for data) Marketplace in Android Studio

      If Android Studio slows down when working with large Flutterprojects, try:

      • ๐Ÿ”ง Enlarge Heap Size to Help โ†’ Edit Custom VM Options (add line -Xmx4G).
      • ๐Ÿ—‘๏ธ Clear cache once a week (File โ†’ Invalidate Caches).

      7. Working with dependencies: pubspec.yaml and common errors

      The file is the heart of any project. Dependencies ( pubspec.yaml - anyone's heart Flutter-project. Dependencies are indicated here (packages), resources and application settings are indicated here. Errors in this file are one of the main reasons for build failures.

      Basic rules of operation. with pubspec.yaml:

      • ๐Ÿ“Œ Versioning:
        • Use ^1.2.3 to automatically update minor versions.
        • For stability, fix versions without ^ (for example, 1.2.3).
      • ๐Ÿ”„ Update dependencies:
        • Run flutter pub outdated to check for outdated packages.
        • Update dependencies with command flutter pub upgrade.
      • ๐Ÿšซ Dependency conflicts:
        • If two packages require different versions of the same library, use dependency_overrides (carefully!).

      Example of correct pubspec.yaml:

      name: my_app
      

      description: A new Flutter project

      version: 1.0.0+1

      environment:

      sdk: ">=2.19.0 <3.0.0"

      dependencies:

      flutter:

      sdk: flutter

      cupertino_icons: ^1.0.2

      http: 0.13.5 # Fixed version for stability

      dev_dependencies:

      flutter_test:

      sdk: flutter

      flutter_lints: ^2.0.0

      Frequent errors and solutions:

      • ๐Ÿšจ "Because every version of package X depends on Y, which doesn't match...":
        How to resolve the conflict dependencies?

        Use the command flutter pub deps --style=compactto see the chain of dependencies. Then add the pubspec.yaml block dependency_overrides block with the desired package version. For example:

        dependency_overrides:
        

        shared_preferences: 2.0.15

        Attention: This is a temporary solution! Update the main dependencies as soon as possible.

      • ๐Ÿšจ "Target of URI doesn't exist: 'package:...":
        • Do flutter pub get.
        • Check for typos in the package name.
      โš ๏ธ Attention: Never commit a folder to the repository .pub-cache โ€”it takes up gigabytes and contains temporary files. Add it to .gitignore.

      FAQ: Answers to frequently asked questions

      Is it possible to use Flutter in Android Studio without plugins?

      Technically yes, but it is extremely inconvenient. Without plugins Flutter and Dart you will lose:

      • ๐Ÿ” Syntax highlighting and code completion.
      • ๐Ÿž Built-in debugger and Hot Reload.
      • ๐Ÿ“ฆ Management dependencies through the interface Android Studio.

    Plugins take up less 50 MB and significantly speed up development.

    How to update Flutter to the latest version?

    Execute in the terminal:

    flutter upgrade

    If you need to switch to another channel (for example, beta):

    flutter channel beta
    

    flutter upgrade

    After the update, restart Android Studio and run flutter doctor.

    Why does the emulator not see the physical device?

    Check:

    1. Enabled whether USB Debugging on the phone (Settings โ†’ For developers).
    2. Are drivers installed for your device (especially important for Windows).
    3. Is the phone connected in mode Transfer files (not Only charging).
    4. Has the command been executed adb devices in the terminal (the serial number of the device should be displayed).

    If the device is still not detected, try:

    adb kill-server
    

    adb start-server

    How to speed up the build of a Flutter project?

    Here are several ways:

    • ๐Ÿ”ฅ Use --release only for the final build:
      flutter run --release
    • ๐Ÿ—‘๏ธ Clear the cache before building:
      flutter clean
    • ๐Ÿ› ๏ธ Disable unnecessary plugins in pubspec.yaml (especially in mode development).
    • ๐Ÿ–ฅ๏ธ Increase memory for Gradle v android/gradle.properties:
      org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=1G
    Is it possible to develop on Flutter without Android Studio?

    Yes, but with limitations:

    • ๐Ÿ’ป VS Code +. extensions Flutter i Dart โ€”a light and fast environment, but without a built-in emulator.
    • ๐Ÿ“ฑ IntelliJ IDEA โ€”similar to Android Studio, but without specialized tools for Android.
    • ๐Ÿง Terminal โ€”you can write code in any editor and run command flutter run manually.

    However, for full development under Android Android Studio remains the best choice due to integration with AVD i Gradle.