Here’s a concise guide for installing and configuring Flutter along with the Linux toolchain and Android toolchain on a Linux system:
Ensure your system meets the following requirements:
- 64-bit Linux distribution
- Ubuntu 20.04 or later is recommended
Open your terminal and run the following commands to install necessary dependencies:
sudo apt update
sudo apt install git curl wget unzip xz-utils zip
sudo apt install libglu1-mesa libxi6 libgconf-2-4 libgtk-3-dev
-
Download Flutter SDK:
cd ~/development git clone https://github.com/flutter/flutter.git -b stable
-
Add Flutter to PATH: Add the following lines to your
~/.bashrc
or~/.bash_profile
:export FLUTTER_HOME="$HOME/development/flutter" export PATH="$PATH:$FLUTTER_HOME/bin"
-
Apply the changes:
source ~/.bashrc
-
Install Android Studio: You can download it from Android Studio or use:
sudo snap install android-studio --classic
-
Configure the Android SDK: Launch Android Studio, go to Configure > SDK Manager and ensure you install:
- Android SDK
- Android SDK Platform-Tools
- Android SDK Build-Tools
If you prefer using command-line tools instead of Android Studio, install the Android command-line tools as follows:
-
Download Command Line Tools:
- Navigate to Android Command Line Tools and download the package for Linux.
-
Extract the package:
mkdir -p ~/Android/Sdk/cmdline-tools unzip commandlinetools-linux-*.zip -d ~/Android/Sdk/cmdline-tools
-
Set up the environment variables: Add the following lines to your
~/.bashrc
or~/.bash_profile
:export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
-
Apply the changes:
source ~/.bashrc
Run the following command to point Flutter to the Android SDK location:
flutter config --android-sdk ~/Android/Sdk
If you want to develop for the web, install Chrome:
sudo apt install google-chrome-stable
Run flutter doctor
to check if everything is set up correctly:
flutter doctor