Install Flutter in Linux without Android Studio
INSTALL FLUTTER WITHOUT ANDROID STUDIO ON LINUX
sudo pacman -S jdk17-openjdk
sudo pacman -S git
cd ~/
mkdir Android
cd Android
mkdir cmdline-tools
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
Now move the “flutter” folder to the “Home/Android/” directory
sudo mv flutter/ ~/Android/
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
Now move the “tools” folder to the “HOME/Android/cmdline-tools” directory
sudo mv tools/ ~/Android/cmdline-tools/
Now the full path looks like this
cd ~
sudo nano .zshrc //i am using here zsh
Now write this at the end of the .zsrch or .bashrc file
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 PATH=$JAVA_HOME/bin:$PATH # Java
save the file
sdkmanager --list
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"
Now accept the licenses.
sdkmanager --licenses
sdkmanager "emulator"
sdkmanager "system-images;android-31;default;x86_64"
avdmanager create avd -n pixel -k "system-images;android-31;default;x86_64" --device "pixel"
In my case the .android folder is located in ~/.config to make flutter recognize it.
ln -sf ~/.config/android/ ~/
flutter config --android-sdk ~/Android
flutter doctor -v
This command give 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
Run this command
flutter doctor -v
your phone show a popup click on allow
In terminal type
emulator -avd pixel
then run following commands.
In terminal type:
cd Desktop/
flutter create hello_world
cd hello_world
flutter run