Installing Flutter in Ubuntu

The following steps are there to be followed for a successful installation.

  • Downloading and setting the path of JAVA.

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

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)

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 that 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 the 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 the 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 in repositories’ and from there you will install Flutter and Dart plugin for Android Studio.

Tech enthusiast | AWS | Ansible | Docker | Kubernetes | Jenkins | ML | Python | JavaScript🤓