Flutter – Install on Linux
To get started with Flutter on Linux, we should get Flutter SDK, Android SDK, setup and configure Android Studio for Flutter, setup the Android Device or Emulator. Also, to run Flutter, the computer should meet the minimum hardware and software requirements.
Hardware and Software Requirements
To install Flutter on your system running on Linux, following are the minimum hardware and software requirements
Operating System | Linux (64 bit) |
Disk Space | 600MB + Space for IDE and dependent Software Tools |
Software Tools | bash, mkdir, rm, git, curl, unzip, which |
Download Flutter SDK
Step 1: Open Flutter SDK Archive.
https://flutter.io/sdk-archive/#linux.
Step 2: Download the latest Flutter SDK.
As on the date of writing this article, v0.3.2 is the latest in Beta channel. Click on the link provided for latest SDK tar file. (SDK has not yet matured to stable version)
Step 3: Extract the Flutter SDK.
Navigate to the location of TAR file and run the following command.
$ tar xf flutter_linux_v0.3.2-beta.tar.xz
Step 4: Add flutter/bin to PATH.To append complete path of flutter/bin to PATH variable, open .bash_profile file in edit mode and add the following line at the end of the file.
[PATH_TO_FLUTTER_SDK_DIRECTORY] =
Step 4.1: Get the complete path to flutter sdk directory.
This value changes based on where you extracted the SDK. Right click and open a terminal from the window where you extracted flutter. You can get the whole path by running pwd command in that terminal.
$ pwd /media/arjun/0AB650F1B650DF2F/softs/flutter
[PATH_TO_FLUTTER_SDK_DIRECTORY] = /media/arjun/0AB650F1B650DF2F/softs/flutter
Step 4.2: For UBUNTU, add the complete path of [PATH_TO_FLUTTER_SDK_DIRECTORY]/flutter/bin to PATH in .bashrc file.
Run the following command to open .bashrc file in edit mode. [You may also use vi or any other editor].
~$ sudo nano ~/.bashrc
Add the following line at the end of the file and save.
export PATH="[PATH_TO_FLUTTER_SDK_DIRECTORY]/flutter/bin:$PATH"
For Example
export PATH="/media/arjun/0AB650F1B650DF2F/softs/flutter/flutter/bin:$PATH"
Step 4.3: Restart the terminal and run following command.
~$ echo $PATH
Path to the flutter SDK bin folder should be echoed, along with the previous PATH value.
Flutter SDK Setup is complete.
Android Studio Setup
Download Latest Android Studio (3.0 or later) and follow the Wizard for installation. This will install the latest Android SDK, Android SDK Platform-Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.
Install Flutter and Dart plugins
Step 1: To install Flutter and Dart plugins in Android Studio.
Open Android Studio and open an existing project or create a new one.
Step 2: Under Menu -> File -> Settings -> Plugins, search for flutter and click on “Search in repositories.”
Step 3: Click on Install button.
Click on Yes, to insert both Dart and Flutter plugins.
Step 3: Restart the Android Studio.
In Menu, under File -> New, New Flutter Project should appear.
Run Flutter Doctor Command
To check if the installation is successful, run flutter doctor command as shown below :
arjun@localhost:~$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel beta, v0.3.2, on Linux, locale en_IN)
[?] Android toolchain - develop for Android devices
? Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[?] Android Studio (version 3.1)
[!] IntelliJ IDEA Community Edition (version 2017.2)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
[!] Connected devices
! No devices available
! Doctor found issues in 3 categories.
arjun@localhost:~$
Flutter SDK installation is good.
It is not able to find Android SDK. We have Android SDK already installed, so we shall go with the option of setting $ANDROID_HOME. Add the following line at the end of .bashrc file.
#android sdk
export ANDROID_HOME="/media/arjun/0AB650F1B650DF2F/Android/Sdk"
If you have IntelliJ IDEA installed, and would like to work with Flutter in IntelliJ IDEA, you should install the Dart and Flutter plugins in IntelliJ IDEA as well. The procedure for installing the plugins would be same as that of in Android Studio.
Enable Debugging Mode in Android Device and connect to the system.
If you face any other issues when you run flutter doctor command, the solution would be provided in the description itself. Get your hands dirty with setting up the environment and lets get started with creating and running a basic application with Flutter on Android Studio.
Once all the issues are resolved, flutter doctor command would output as shown below :
~$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel beta, v0.3.2, on Linux, locale en_IN)
[?] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[?] Android Studio (version 3.1)
[?] IntelliJ IDEA Community Edition (version 2017.2)
[?] Connected devices (1 available)
• No issues found!
Conclusion
In this Flutter Tutorial – Install Flutter on Linux, we have learnt to install Flutter SDK, configure Android Studio with Flutter and Dart.