
Installing Flutter
- Install Flutter using snap using following terminal command
sudo snap install flutter --classic
If you use this way you don’t have to set environment variables.
(Or)
- Install Flutter using ZIP file
- Download Flutter using this Official Website for Flutter
- Go to where you downloaded the Flutter package and extract it.
tar xvf flutter_linux_1.17.3-stable.tar.xz
Move the flutter folder to a new directory. I will also move it to my home directory.
sudo mv flutter/ ~/
Go to your home directory, open up .profile in your favorite editor, and type the lines below. Save your file.
# Flutter
export FLUTTER=$HOME/flutter
export PATH=$FLUTTER/bin:$PATH
Now our environment variables are created, and to make it work, all we need to do is type the line below in the terminal
source ~/.profile
Install VSCode
- Install VSCode using debian file (install flutter plugins)
- Go to the folder where you downloaded the VSCode and install it. and Install flutter plugins in extention.
sudo dpkg -i vs_code.deb
Install Git using Terminal
- Install Git using apt Package manager in terminal
sudo apt install git
Install Java(openjdk) using Terminal
- Install openjdk-8-jre
sudo apt install openjdk-8-jre
- Install openjdk-8-jdk-headless
sudo apt install openjdk-8-jdk-headless
Download and Configure the android sdk
- Download command-line tools package from google developers site.
- Go to the folder where you downloaded the command line tools package and unzip the file. You can use the ls command to find out the name of the file.
unzip commandlinetools-linux-6514223_latest.zip
- Now, create a new folder and name it Android, and then move the folder you extract to this new folder.
mkdir Android
sudo mv tools/ Android/
- We’re going to move the Android folder to another directory. I will move it to my home folder.
sudo mv Android/ ~/
- Go to your home directory and open the file .profile in your favorite editor. This file will keep your environment variables.
cd ~/
sudo gedit .profile
- At the end of the file, type, or copy these few lines. Make sure you don’t put extra spaces and then save your file.
- Note: If you did not move your Android folder to the home directory, substitute the first line with the path to where you move it.
# Android
export ANDROID=$HOME/Android
export PATH=$ANDROID/tools:$PATH
export PATH=$ANDROID/tools/bin:$PATH
export PATH=$ANDROID/platform-tools:$PATH
# Android SDK
export ANDROID_SDK=$HOME/ANDROID
export PATH=$ANDROID_SDK:$PATH
- The android-29 means we are getting Android 10 in our emulator. If you want Android 11 just put android-30, and for the older ones, you can downgrade the number.
Set SDK_Manager Path
sdkmanager --sdk_root=${ANDROID} tools
Type the following lines in your terminal.
sdkmanager "system-images;android-29;google_apis;x86_64"
sdkmanager "platforms;android-29"
sdkmanager "platform-tools"
sdkmanager "patcher;v4"
sdkmanager "emulator"
sdkmanager "build-tools;29.0.2"
Now accept the licenses.
sdkmanager --licenses
Creating the Emulator
Type the line below and this will show a list of devices, choose one, and copy its ID.
avdmanager list
Give a name to your emulator and paste the ID that you copy on the following line.
avdmanager -s create avd -nname-k "system-images;android-29;google_apis;x86_64" -did_device
Did it Work?
Run
flutter doctor
It should appear all green for the exception of the Android Studio path. If everything worked fine, now let’s launch the emulator
Flutter Configuration
- We are going to configure Flutter by setting the path to the Android SDK.
flutter config --android-sdk ~/Android
- We can use our linux to run the flutter app.
flutter config --enable-linux-desktop
Video tutorial
1 thought on “Install Flutter without android studio on GNU/Linux”