- Linux install
- Get the Flutter SDK
- Install Flutter using snapd
- Install Flutter manually
- Run flutter doctor
- Update your path
- Update the path directly
- Android setup
- Install Android Studio
- Set up your Android device
- Set up the Android emulator
- Agree to Android Licenses
- Linux setup
- Additional Linux requirements
- Next step
Linux install
To install and run Flutter, your development environment must meet these minimum requirements:
- Operating Systems: Linux (64-bit)
- Disk Space: 600 MB (does not include disk space for IDE/tools).
- Tools: Flutter depends on these command-line tools being available in your environment.
- bash
- curl
- file
- git 2.x
- mkdir
- rm
- unzip
- which
- xz-utils
- zip
- libGLU.so.1 — provided by mesa packages such as libglu1-mesa on Ubuntu/Debian and mesa-libGLU on Fedora.
Get the Flutter SDK
error Important: If you’re in China, read Using Flutter in China.
On Linux, you have two ways you can install Flutter.
Install Flutter using snapd
The easiest way to install Flutter on Linux is by using snapd. For more information, check out Installing snapd.
Once you have snapd, you can install Flutter using the Snap Store, or at the command line:
$ sudo snap install flutter --classic
info Note: Once you install snap, use the following command to display your Flutter SDK path:
Install Flutter manually
If you don’t have snapd , or can’t use it, you can install Flutter using the following steps.
- Download the following installation bundle to get the latest stable release of the Flutter SDK: (loading…) For other release channels, and older builds, check out the SDK archive.
- Extract the file in the desired location. For example:
$ cd ~/development $ tar xf ~/Downloads/flutter_linux_vX.X.X-stable.tar.xz
$ export PATH="$PATH:`pwd`/flutter/bin"
You are now ready to run Flutter commands!
info Note: To update an existing version of Flutter, check out Upgrading Flutter.
Run flutter doctor
Run the following command to see if there are any dependencies you need to install to complete the setup (for verbose output, add the -v flag):
This command checks your environment and displays a report to the terminal window. The Dart SDK is bundled with Flutter; it isn’t necessary to install Dart separately. Check the output carefully for other software you might need to install or further tasks to perform (shown in bold text).
[-] Android toolchain - develop for Android devices • Android SDK at /Users/dash/Library/Android/sdk ✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ • Try re-installing or updating your Android SDK, visit https://docs.flutter.dev/setup/#android-setup for detailed instructions.
The following sections describe how to perform these tasks and finish the setup process.
Once you have installed any missing dependencies, run the flutter doctor command again to verify that you’ve set everything up correctly.
report_problem Warning: The Flutter tool might occasionally download resources from Google servers. By downloading or using the Flutter SDK you agree to the Google Terms of Service.
For example, when installed from GitHub (as opposed to from a prepackaged archive), the Flutter tool downloads the Dart SDK from Google servers immediately when first run, as it is used to execute the flutter tool itself. This also occurs when Flutter is upgraded (for example, by running the flutter upgrade command).
The flutter tool uses Google Analytics to report feature usage statistics and send crash reports. This data is used to help improve Flutter tools over time.
Flutter tool analytics are not sent on the very first run. To disable reporting, run flutter config —no-analytics . To display the current setting, use flutter config . If you opt out of analytics, an opt-out event is sent, and then no further information is sent by the Flutter tool.
Dart tools might also send usage metrics and crash reports to Google. To control the submission of these metrics, use the following options on the dart tool:
- —enable-analytics : Enables anonymous analytics.
- —disable-analytics : Disables anonymous analytics.
The Google Privacy Policy describes how data is handled by these services.
Update your path
You can update your PATH variable for the current session at the command line, as shown in step 3 of Get the Flutter SDK. To update this variable permanently so you can run flutter commands in any terminal session, use the following instructions.
The steps for modifying the PATH variable all subsequent terminal sessions are machine-specific. Typically, you add a line to a shell script file that executes whenever you open a new window. For example:
- Determine the path of your clone of the Flutter SDK. You need this in Step 3.
- Open (or create) the rc file for your shell. For example, Linux uses the Bash shell by default, so edit $HOME/.bashrc . If you are using a different shell, the file path and filename will be different on your machine.
- Add the following line, changing the [PATH_OF_FLUTTER_GIT_DIRECTORY] to the path of your copy of the Flutter SDK:
$ export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
info Note: Downloading the Flutter SDK also downloads a compatible version of Dart. If you’ve downloaded the Dart SDK separately, make sure that the Flutter version of dart is first in your path, as the two versions might not be compatible. The following command tells you whether the flutter and dart commands originate from the same bin directory and are therefore compatible.
$ which flutter dart /path-to-flutter-sdk/bin/flutter /usr/local/bin/dart
As shown above, the two commands don’t come from the same bin directory. Update your path to use commands from /path-to-flutter-sdk/bin before commands from /usr/local/bin (in this case). After updating your shell for the change to take effect, running the which command again should show that the flutter and dart commands now come from the same directory.
$ which flutter dart /path-to-flutter-sdk/bin/flutter /path-to-flutter-sdk/bin/dart
To learn more about the dart command, run dart -h from the command line, or see the dart tool page.
Update the path directly
In some cases, your distribution might not permanently acquire the path when using the previous directions. When this occurs, you can change the environment variables file directly. These instructions require administrator privileges:
- Determine the path of your clone of the Flutter SDK.
- Locate the etc directory at the root of the system, and open the profile file with root privileges.
if [ "`id -u`" -eq 0 ]; then PATH=". " else PATH="/usr/local/bin. [PATH_OF_FLUTTER_GIT_DIRECTORY]/bin" fi export PATH
For more details on setting the path in Bash, see this StackExchange question. For information on setting the path in Z shell, see this StackOverflow question.
Android setup
info Note: Flutter relies on a full installation of Android Studio to supply its Android platform dependencies. However, you can write your Flutter apps in a number of editors; a later step discusses that.
Install Android Studio
- Download and install Android Studio.
- Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.
- Run flutter doctor to confirm that Flutter has located your installation of Android Studio. If Flutter cannot locate it, run flutter config —android-studio-dir= to set the directory that Android Studio is installed to.
Set up your Android device
To prepare to run and test your Flutter app on an Android device, you need an Android device running Android 4.1 (API level 16) or higher.
- Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
- [Optional] To leverage wireless debugging, enable Wireless debugging on your device. Detailed instructions are available in the Android documentation.
- Windows-only: Install the Google USB Driver.
- Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
- In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device. By default, Flutter uses the version of the Android SDK where your adb tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_SDK_ROOT environment variable to that installation directory.
Set up the Android emulator
To prepare to run and test your Flutter app on the Android emulator, follow these steps:
- Enable VM acceleration on your machine.
- Launch Android Studio, click the Device Manager icon, and select Create Device under Virtual tab…
- In older versions of Android Studio, you should instead launch Android Studio > Tools > Android > AVD Manager and select Create Virtual Device…. (The Android submenu is only present when inside an Android project.)
- If you do not have a project open, you can choose 3-Dot Menu / More Actions > Virtual Device Manager and select Create Device…
- Choose a device definition and select Next.
- Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
- Under Emulated Performance, select Hardware — GLES 2.0 to enable hardware acceleration.
- Verify the AVD configuration is correct, and select Finish. For details on the above steps, see Managing AVDs.
- In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.
Agree to Android Licenses
Before you can use Flutter, you must agree to the licenses of the Android SDK platform. This step should be done after you have installed the tools listed above.
- Open an elevated console window and run the following command to begin signing licenses.
$ flutter doctor --android-licenses
Linux setup
Additional Linux requirements
For Linux desktop development, you need the following in addition to the Flutter SDK:
Run the following command
$ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
Next step
Set up your preferred editor.
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the BSD License.