Installing Flutter in Ubuntu

Harsh Gupta
3 min readMar 1, 2019

--

WHAT IS FLUTTER?

Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. It is used to develop applications for Android and iOS, as well as being the primary method of creating applications for Google Fuchsia. Using a single codebase, you can develop mobile apps for both Android and iOS in the same time without putting extra effort. Flutter works with existing code,and is used by developers and organisations around the world, and is free and open source.

Now we know about Flutter. But this article does not focuses on What is Flutter, but focuses on Flutter installation in Ubuntu Linux. Following steps are there to be followed for successful installation.

  • Downloading and setting the path of JAVA.
  • Downloading and setting the path of Android SDK.
  • Installing Flutter in Linux and setting the path.
  • Solving the flutter run issues.

1. Install JDK 6 or later

First, we will install Oracle JDK 8. Run the following commands on the terminal in Ubuntu.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

To make sure, it’s installed successfully, open a terminal and type

java -version 

2. Download and install Android Studio

SYSTEM REQUIREMENTS

  • Tested on Ubuntu® 16.04 LTS
  • 64-bit distribution capable of running 32-bit applications
  • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
  • 2 GB of available disk space minimum,
    4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
  • 1280 x 800 minimum screen resolution

Download the Android Studio package for Linux and extract it somewhere (e.g home directory).

To launch Android Studio, open a terminal, navigate to the android-studio/bin/ directory, and execute studio.sh.

cd android-studio/bin
./studio.sh

Select whether you want to import previous Android Studio settings or not, then click OK.

Download the various files of the Android SDK. By default, the Android Studio installation process forces you to download the latest Android SDK, so you have to download that.

After downloading the latest Android SDK, Click on ‘Start a new Android Studio Project. This will create a sample Android project. The initial build of the first sample project takes some time as Android Studio builds the project and sets all the default settings in the system.

If you want to setup a desktop entry for Android Studio then you can do it by clicking on Tools menu -> Create Desktop Entry.
Now you can open Android Studio directly from the launcher. You can also pin Android Studio to the launcher.

Android Studio sets the path of its SDK automatically, so you don’t need to configure it.

3. Download and install Flutter

You can download the Flutter SDK from flutter.io for Linux version.

You’ve to have a 64 bit os to install it , so at first confirm that you have the 64 bit version of Linux.

System requirements

  • Operating Systems: Linux (64-bit)
  • Disk Space: 600 MB (does not include disk space for IDE/tools).

After downloading the Flutter SDK, you should extract the file in the desired location, for example:

cd ~/Documents
$ tar xf ~/Downloads/flutter_linux_v1.2.1-stable.tar.xz

By running the above commands, you will extract the Flutter SDK at Documents folder.

Now you need to update the PATH to add the Flutter SDK.

Open a terminal and go to the home directory and then to current user directory by typing the following command.

cd /home/{current_user} 

Type the following commands to update the path.

gedit .bashrc

A file opens for editing. Be careful while dealing with this file as this is the file which contains the system configurations.
At the end of this file add the path of the Flutter SDK.

export PATH={path-of-sdk}/flutter/bin:$PATH

For eg.
export PATH=/home/{current-user}/flutter/bin:$PATH

The above example works if the Flutter SDK is in home directory.

Save and close the file and then also close the terminal.

Then run echo$PATH in another terminal to see the updated path.
This will show you the updated path which contains the Flutter SDK.

Now run flutter doctor in the terminal. If no errors were there then flutter doctor will run successfully.

4. Download and install Flutter plugin in Android Studio

Now you just need to install Flutter plugin in Android Studio. You can do this by going into File->Settings->Plugins and then search for Flutter in ‘Search inrepositories’ and from there you will install Flutter and Dart plugin for Android Studio.

Now you have successfully installed Flutter in your Ubuntu system. You are all set to go and develop awesome apps in Flutter. Happy Coding

--

--