FlutterLinuxInstallInstallationHow ToTutorial

Install Flutter in Linux without Android Studio

Here I will show you how we can set up Flutter in Linux without installing Android Studio. This is very useful if your PC runs slow or don’t like the android studio and you want to code in some other editor.

Reminder: Guys, This all process is tested in arch based distros. Please install the packages accordingly with your package installer.

Use the terminal for this tutorial.

I am using java 17. You can use other version too.

Install Java

sudo pacman -S openjdk-17-jdk
Shell

Install Git

sudo pacman -S git
Shell

Setting Up Folder

I am keeping everything in a single directory. Use a terminal or you can make a folder inside the “home” directory.

cd ~/
mkdir Android && cd Android
mkdir cmdline-tools
Shell

Install Flutter SDK

Download Flutter

Go to the folder where you downloaded the zip file and unzip the file. You can unzip it by right click on the file and click on extract here or using the terminal by the following code.

unzip flutter_linux_3.3.10-stable.tar.xz
Shell

Now move the flutter folder to the ~/Android/ directory

sudo mv flutter/ ~/Android/
Shell

Now the full path looks like this

~/Android/flutter

Install Android Command Line Tools

Download Android command-line tools for Linux

Got to the folder where you downloaded the file and unzip the file.

sudo tar -xvf commandlinetools-linux-11076708_latest.zip
Shell

Now move the tools folder to the ~/Android/cmdline-tools directory

sudo mv tools/ ~/Android/cmdline-tools/
Shell

Now the full path looks like this

~/Android/cmdline-tools/tools

Set Some ENV Variables

cd ~
sudo nano .zshrc
Shell
export ANDROID=$HOME/Android
export PATH=$ANDROID/cmdline-tools/tools:$PATH
export PATH=$ANDROID/cmdline-tools/tools/bin:$PATH
export PATH=$ANDROID/platform-tools:$PATH # Android SDK
export PATH=$ANDROID/emulator:$PATH
export ANDROID_SDK=$HOME/ANDROID

export PATH=$ANDROID_SDK:$PATH # Flutter
export FLUTTER=$ANDROID/flutter
export PATH=$FLUTTER/bin:$PATH

export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
export
Shell

Download Android SDK

So for Flutter to run we need to install system-image, platform-tools,builde-tools,platforms:android,cmdline-tools;latest.

I am using android-31, you can use the version which is compatible with your Android device. If you want to see all available versionsfor system-image, platform-tools, build-tools, and platforms; android type the following in the terminal.

sdkmanager --list
Shell

for version 31 type the following command in terminal

sdkmanager “system-images;android-31;default;x86_64”
sdkmanager "platforms;android-31"
sdkmanager “platform-tools”
sdkmanager "build-tools;31.0.0"
Shell

Now accept the licenses.

sdkmanager --licenses
Shell

Install Android Emulator

sdkmanager "emulator"
Shell

Setup Android Emulator

sdkmanager "system-images;android-31;default;x86_64"
avdmanager create avd -n pixel -k "system-images;android-31;default;x86_64" --device "pixel"
Shell

In my case the .android folder is located in ~/.config to make flutter recognize it.

ln -sf ~/.config/android/ ~/

Configure SDK path for Flutter

flutter config --android-sdk ~/Android
Shell

Call flutter doctor

flutter doctor -v
Shell

This command gives you all green tick, ignore [!] at android studio because we are not using it.

if it ask for Accept Licenses with flutter doctor use below command to accept licenses

flutter doctor --android-licenses
Shell

your phone show a popup click on allow

If you don’t want to use your phone then do following.

emulator -avd pixel
Shell

Test flutter code

cd Desktop/
flutter create hello_world
cd hello_world
flutter run
Shell

Happy Coding!