Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase. If you’re using Linux and want to start developing Flutter Android apps, this guide will walk you through the complete installation process for Android development.
System Requirements
Before we begin, make sure you have:
- Linux Distribution: Debian 11 or later, or Ubuntu 22.04 LTS or later
- Architecture: x86_64 (64-bit) system
- Storage: At least 3.5 GB of free disk space (Flutter SDK + Android toolchain)
- RAM: 8GB minimum, 16GB recommended for Android development
- Internet connection: To download Flutter SDK and dependencies
- Sudo privileges: Administrative access for installing packages
Step 1: Install System Dependencies
First, update your system and install the required packages:
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
What these packages do:
curl
: Downloads files from the internetgit
: Version control system (required for Flutter)unzip
&xz-utils
: Extract compressed fileszip
: Create compressed archiveslibglu1-mesa
: OpenGL utility library
Step 2: Install Android Development Prerequisites
If you plan to develop Android apps (most common use case), install additional packages:
sudo apt-get install libc6:amd64 libstdc++6:amd64 lib32z1 libbz2-1.0:amd64
These packages are required for Android Studio and the Android SDK to function properly.
Step 3: Download Flutter SDK
Create a directory for Flutter and download the SDK:
mkdir -p ~/development
cd ~/development
Download the latest stable Flutter release:
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.32.4-stable.tar.xz
Or if you prefer using curl:
curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.32.4-stable.tar.xz
Step 4: Extract Flutter SDK
Extract the downloaded Flutter SDK:
tar -xf flutter_linux_3.32.4-stable.tar.xz
This creates a flutter
directory in ~/development/
containing the Flutter SDK.
Step 5: Add Flutter to PATH
Add Flutter to your system PATH so you can run Flutter commands from anywhere.
First, check your default shell:
echo $SHELL
Then add Flutter to your PATH based on your shell:
For Bash users:
echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.bashrc
For Zsh users:
echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.zshrc
For Fish users:
fish_add_path -g -p ~/development/flutter/bin
Apply the changes:
source ~/.bashrc # or ~/.zshrc for Zsh users
Step 6: Verify Flutter Installation
Test that Flutter is properly installed:
flutter --version
You should see output similar to:
Flutter 3.32.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 0a3dcf... (2 weeks ago) • 2024-05-30 08:44:27 -0500
Engine • revision 6b9068a...
Tools • Dart 3.4.0 • DevTools 2.34.3
Step 7: Run Flutter Doctor
Flutter includes a helpful diagnostic tool. Run it to check your setup:
flutter doctor
This command checks your environment and displays a report of the status of your Flutter installation. Don’t worry if you see some issues – we’ll address them in the next steps.
Step 8: Install Android Studio (For Android Development)
Download and install Android Studio for Android app development:
- Download Android Studio:
cd ~/Downloads
curl -L https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2024.1.1.11/android-studio-2024.1.1.11-linux.tar.gz -o android-studio-linux.tar.gz
- Extract and install:
sudo tar -xzf android-studio-linux.tar.gz -C /opt/
- Create a desktop entry:
sudo ln -sf /opt/android-studio/bin/studio.sh /usr/local/bin/android-studio
- Launch Android Studio:
android-studio
Step 9: Configure Android Studio
When you first launch Android Studio:
- Follow the setup wizard and install:
- Android SDK Platform, API 35
- Android SDK Command-line Tools
- Android SDK Build-Tools
- Android SDK Platform-Tools
- Android Emulator
- Accept Android licenses:
flutter doctor --android-licenses
Accept all the license agreements when prompted.
Step 10: Set Up Development Environment
Install Visual Studio Code (Recommended):
For Ubuntu/Debian:
# Add Microsoft GPG key
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code
For Fedora:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
sudo dnf install code
For Arch Linux:
yay -S visual-studio-code-bin
Or download the .deb package directly from Microsoft’s website.
Install Flutter extension:
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for „Flutter“ and install the official Flutter extension
- This will also install the Dart extension automatically
Step 11: Create and Test Your First Flutter App
Create a new Flutter project to verify everything works:
cd ~/development
flutter create my_first_app
cd my_first_app
Run the app:
flutter run
If you have an Android emulator running or a device connected, the app will launch and display „Hello, World!“
Step 12: Set Up Android Emulator (Optional)
To test your apps without a physical device:
- Open Android Studio
- Go to Tools > Device Manager
- Click „Create Device“
- Select a device definition (e.g., Pixel 7)
- Choose a system image (latest Android version)
- Configure and create the AVD
Start the emulator:
flutter emulators --launch <emulator_name>
What Gets Installed
Your Flutter installation includes:
- Flutter SDK: Core framework and tools
- Dart SDK: Programming language for Flutter
- flutter CLI: Command-line tools for project management
- Android toolchain: For building Android apps
- VS Code extensions: Development environment enhancements
Important Notes
Storage Requirements: Flutter SDK takes about 1.5 GB, and Android Studio with SDK requires an additional 3-4 GB.
Updates: Flutter releases updates regularly. Keep your installation current with:
flutter upgrade
Multiple Platforms: This guide focuses on Android development. Flutter also supports iOS (requires macOS), web, and desktop development.
Troubleshooting
Common issues and solutions:
- Flutter command not found:
- Restart your terminal or run
source ~/.bashrc
- Verify PATH is correctly set
- Restart your terminal or run
- Android licenses not accepted:
- Run
flutter doctor --android-licenses
and accept all
- Run
- Missing Android SDK:
- Ensure Android Studio setup wizard completed successfully
- Check SDK path in Android Studio settings
- Emulator won’t start:
- Enable hardware acceleration in BIOS
- Ensure sufficient RAM (8GB+ recommended)
- Permission errors:
- Never run flutter commands with sudo
- Check file permissions in development directory
Alternative Installation Methods
Using official Flutter installation script:
# Download and run the official installer
curl -fsSL https://github.com/flutter/flutter/releases/download/stable/flutter_linux_3.32.4-stable.tar.xz | tar -xJ -C ~/development/
From GitHub releases: You can also download Flutter directly from the official GitHub releases page at https://github.com/flutter/flutter/releases
Note: Avoid using package managers like apt or dnf for Flutter as they often contain outdated versions. Always use the official Flutter releases for the best experience.
Uninstalling Flutter
To remove Flutter completely:
- Remove Flutter directory:
rm -rf ~/development/flutter
- Remove PATH entry from your shell configuration file (
.bashrc
,.zshrc
, etc.) - Remove Android Studio (if no longer needed):
sudo rm -rf /opt/android-studio
Next Steps
Now that Flutter is installed on your Linux system for Android development, you can:
- Complete the Flutter codelab: Build your first Flutter app
- Explore Flutter samples: Check out flutter.dev/docs/cookbook
- Join the community: Flutter Discord and Stack Overflow
- Learn Dart: The programming language behind Flutter
- Deploy to Google Play Store: Publish your Android apps
- Add other platforms: Extend to web, desktop, or iOS development
Keeping Flutter Updated
Flutter releases updates frequently with new features and bug fixes:
flutter upgrade
This command updates both Flutter and Dart to the latest stable versions.
Performance Tips
For better development experience:
- Use an SSD: Flutter builds are I/O intensive
- Allocate sufficient RAM: 8GB minimum, 16GB recommended
- Enable hardware acceleration: For Android emulator performance
- Use hot reload: For faster development cycles
Having trouble with your Flutter installation on Linux? Leave a comment and we’ll help you troubleshoot!