Add Android as a target platform for Flutter from Windows start
To add Android as a Flutter app target for Windows, follow this procedure.
Install Android Studio
#- Allocate a minimum of 7.5 GB of storage for Android Studio. Consider allocating 10 GB of storage for an optimal configuration.
- Install Android Studio 2023.3.1 (Jellyfish) 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
#To create Android apps with Flutter, verify that the following Android components have been installed.
- Android SDK Platform, API 35.0.1
- 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.
Launch Android Studio.
The Welcome to Android Studio dialog displays.
Follow the Android Studio Setup Wizard.
Install the following components:
- Android SDK Platform, API 35.0.1
- Android SDK Command-line Tools
- Android SDK Build-Tools
- Android SDK Platform-Tools
- Android Emulator
Launch Android Studio.
Go to the Settings dialog to view the SDK Manager.
If you have a project open, go to Tools > SDK Manager.
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.
Click SDK Platforms.
Verify that Android API 35.0.1 has been selected.
If the Status column displays Update available or Not installed:
Select Android API 35.0.1.
Click Apply.
When the Confirm Change dialog displays, click OK.
The SDK Quickfix Installation dialog displays with a completion meter.
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.
Click SDK Tools.
Verify that the following SDK Tools have been selected:
- Android SDK Command-line Tools
- Android SDK Build-Tools
- Android SDK Platform-Tools
- Android Emulator
If the Status column for any of the preceding tools displays Update available or Not installed:
Select the needed tools.
Click Apply.
When the Confirm Change dialog displays, click OK.
The SDK Quickfix Installation dialog displays with a completion meter.
When the install finishes, click Finish.
Configure your target Android device
#Set up the Android emulator
#To configure your Flutter app to run in an Android emulator, follow these steps to create and select an emulator.
Enable VM acceleration on your development computer.
Start Android Studio.
Go to the Settings dialog to view the SDK Manager.
If you have a project open, go to Tools > Device Manager.
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.
Click Virtual.
Click Create Device.
The Virtual Device Configuration dialog displays.
Select either Phone or Tablet under Category.
Select a device definition. You can browse or search for the device.
Click Next.
Click .
Click one system image for the Android version you want to emulate.
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.
When the download completes, click Finish.
Click Next.
The Virtual Device Configuration displays its Verify Configuration step.
To rename the Android Virtual Device (AVD), change the value in the AVD Name box.
Click Show Advanced Settings and scroll to Emulated Performance.
From the Graphics dropdown menu, select Hardware - GLES 2.0.
This enables hardware acceleration and improves rendering performance.
Verify your AVD configuration. If it is correct, click Finish.
To learn more about AVDs, check out Managing AVDs.
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
#To configure your Flutter app to run on a physical Android device, you need an Android device running Android API level 21 or later.
Enable Developer options and USB debugging on your device as described in the Android documentation.
[Optional] To leverage wireless debugging, enable Wireless debugging on your device as described in the Android documentation.
Plug your device into your windows computer. If your device prompts you, authorize your computer to access your device.
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 theANDROID_SDK_ROOT
environment variable to that installation directory.
Agree to Android licenses
#Before you can use Flutter and after you install all prerequisites, agree to the licenses of the Android SDK platform.
Open an elevated console window.
Run the following command to enable signing licenses.
flutter doctor --android-licenses
If you accepted the Android Studio licenses at another time, this command returns:
[========================================] 100% Computing updates... All SDK package licenses accepted.
You can skip the next step.
Before agreeing to the terms of each license, read each with care.
Troubleshooting licensing issues
#How to fix the error of finding Java install
You might have an issue with the Android SDK locating the Java SDK.
flutter doctor --android-licenses
ERROR: JAVA_HOME is set to an invalid directory: /Applications/Android\ Studio.app/Contents/jre/Contents/Home
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Android sdkmanager tool was found, but failed to run
(/Users/atsansone/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager): "exited code 1".
Try re-installing or updating your Android SDK,
visit https://flutter.dev/to/macos-android-setup for detailed instructions.
The flutter doctor
command returns this error because of how the JAVA_HOME
variable was set. When you add the path to JAVA_HOME
, you can add a backslash to the space between Android
and Studio
or enclose the entire path in matching quotes. You cannot do both.
Look for your JAVA_HOME
path in your appropriate shell resource file.
Change it from:
export JAVA_HOME="/Applications/Android\ Studio.app/Contents/jre/Contents/Home"
to:
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"
Do not include the backslash between Android
and Studio
.
To load this updated environment variable, reload your shell. This example uses the zsh
resource file.
source ~/.zshrc
Check your development setup
#Run Flutter doctor
#The flutter doctor
command validates that all components of a complete Flutter development environment for Windows.
Open PowerShell.
To verify your installation of all the components, run the following command.
PS C:> 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.24.3, on Microsoft Windows 11 [Version 10.0.22621.3155], locale en)
[✓] Windows version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[!] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (version 2022)
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.93)
[✓] 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.
PS C:> 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 Windows apps with Flutter
#Congratulations. Having installed all prerequisites and the Flutter SDK, you can start developing Flutter apps for Android on Windows.
To continue on your learning journey, consult the following guides:
Unless stated otherwise, the documentation on this site reflects the latest stable version of Flutter. Page last updated on 2024-04-22. View source or report an issue.