Add Android as a target platform for Flutter from macOS start

To add Android as a Flutter app target for macOS, follow this procedure.

Install Android Studio

#
  1. Allocate a minimum of 7.5 GB of storage for Android Studio. Consider allocating 10 GB of storage for an optimal configuration.
  2. Install Android Studio 2023.2.1 (Iguana) or later to debug and compile Java or Kotlin code for Android. Flutter requires the full version of Android Studio.

Configure Android development

#

Configure the Android toolchain in Android Studio

#

help Help

To create Android apps with Flutter, verify that the following Android components have been installed.

  • Android SDK Platform, API 34.0.5
  • Android SDK Command-line Tools
  • Android SDK Build-Tools
  • Android SDK Platform-Tools
  • Android Emulator

If you haven't installed these, or you don't know, continue with the following procedure.

Otherwise, you can skip to the next section.

  1. Launch Android Studio.

    The Welcome to Android Studio dialog displays.

  2. Follow the Android Studio Setup Wizard.

  3. Install the following components:

    • Android SDK Platform, API 34.0.5
    • Android SDK Command-line Tools
    • Android SDK Build-Tools
    • Android SDK Platform-Tools
    • Android Emulator
  1. Launch Android Studio.

  2. Go to the Settings dialog to view the SDK Manager.

    1. If you have a project open, go to Tools > SDK Manager.

    2. If the Welcome to Android Studio dialog displays, click the More Options icon that follows the Open button and click SDK Manager from the dropdown menu.

  3. Click SDK Platforms.

  4. Verify that Android API 34.0.5 has been selected.

    If the Status column displays Update available or Not installed:

    1. Select Android API 34.0.5.

    2. Click Apply.

    3. When the Confirm Change dialog displays, click OK.

      The SDK Quickfix Installation dialog displays with a completion meter.

    4. When the install finishes, click Finish.

      After you installed the latest SDK, the Status column might display Update available. This means some additional system images might not be installed. You can ignore this and continue.

  5. Click SDK Tools.

  6. Verify that the following SDK Tools have been selected:

    • Android SDK Command-line Tools
    • Android SDK Build-Tools
    • Android SDK Platform-Tools
    • Android Emulator
  7. If the Status column for any of the preceding tools displays Update available or Not installed:

    1. Select the needed tools.

    2. Click Apply.

    3. When the Confirm Change dialog displays, click OK.

      The SDK Quickfix Installation dialog displays with a completion meter.

    4. When the install finishes, click Finish.

Configure your target Android device

#

Set up the Android emulator

#

help Help

To configure your Flutter app to run in an Android emulator, follow these steps to create and select an emulator.

  1. Enable VM acceleration on your development computer.

  2. Start Android Studio.

  3. Go to the Settings dialog to view the SDK Manager.

    1. If you have a project open, go to Tools > Device Manager.

    2. If the Welcome to Android Studio dialog displays, click the More Options icon that follows the Open button and click Device Manager from the dropdown menu.

  4. Click Virtual.

  5. Click Create Device.

    The Virtual Device Configuration dialog displays.

  6. Select either Phone or Tablet under Category.

  7. Select a device definition. You can browse or search for the device.

  8. Click Next.

  9. Click x86 Images if your Mac runs on an Intel CPU or ARM Images if your Mac runs on an Apple CPU.

  10. Click one system image for the Android version you want to emulate.

    1. If the desired image has a Download icon to the right of the Release Name, click it.

      The SDK Quickfix Installation dialog displays with a completion meter.

    2. When the download completes, click Finish.

  11. Click Next.

    The Virtual Device Configuration displays its Verify Configuration step.

  12. To rename the Android Virtual Device (AVD), change the value in the AVD Name box.

  13. Click Show Advanced Settings and scroll to Emulated Performance.

  14. From the Graphics dropdown menu, select Hardware - GLES 2.0.

    This enables hardware acceleration and improves rendering performance.

  15. Verify your AVD configuration. If it is correct, click Finish.

    To learn more about AVDs, check out Managing AVDs.

  16. In the Device Manager dialog, click the Run icon to the right of your desired AVD. The emulator starts up and displays the default canvas for your selected Android OS version and device.

Set up your target Android device

#

help Help

To configure your Flutter app to run on a physical Android device, you need an Android device running Android API level 21 or later.

  1. Enable Developer options and USB debugging on your device as described in the Android documentation.

  2. [Optional] To leverage wireless debugging, enable Wireless debugging on your device as described in the Android documentation.

  3. Plug your device into your macOS computer. If your device prompts you, authorize your computer to access your device.

  4. Verify that Flutter recognizes your connected Android device.

    By default, Flutter uses the version of the Android SDK where your adb tool is based. To use a different Android SDK installation path with Flutter, set the ANDROID_SDK_ROOT environment variable to that installation directory.

Check your development setup

#

help Help

Run Flutter doctor

#

The flutter doctor command validates that all components of a complete Flutter development environment for macOS.

  1. Open your Terminal.

  2. To verify your installation of all the components, run the following command.

    flutter doctor

As you chose to develop for Android, you do not need all components. If you followed this guide, the result of your command should resemble:

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.4.0 23E214 darwin-arm64, locale en)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.5)
[!] Chrome - develop for the web
[✓] Xcode - develop for iOS and macOS (Xcode 15)
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.89)
[✓] Connected device (1 available)
[✓] Network resources


! Doctor found issues in 1 categories.

Troubleshoot Flutter doctor issues

#

When the flutter doctor command returns an error, it could be for Flutter, VS Code, Android Studio, the connected device, or network resources.

If the flutter doctor command returns an error for any of these components, run it again with the verbose flag.

flutter doctor -v

Check the output for other software you might need to install or further tasks to perform.

If you change the configuration of your Flutter SDK or its related components, run flutter doctor again to verify the installation.

Start developing Android on macOS apps with Flutter

#

Congratulations! Now that you have installed all prerequisites and the Flutter SDK, you should be able to start developing Flutter apps for Android on macOS.