If you are a Linux user like me and prefer lightweight tools like VS Code over Android Studio, setting up Flutter and the Android SDK can be challenging. As a part-time developer at an ISP, I've faced this process recently on Fedora after reinstalling my PC. Here is a detailed guide to help you get Flutter up and running without the bloat.
Prerequisites
- Linux distribution (tested on Fedora and Arch)
- Basic knowledge of bash scripting
Step 1: Install JDK
Flutter and the Android SDK require a Java Development Kit (JDK). It is possible to use a JDK version installed using a package manager of your distribution, but I recommend downloading Eclipse Temurin JDK and using it as a local user installation.
You will have to find a JDK version, that is compatible with your Android SDK platform version. I was unable to find a proper compatibility table, but there is a bit of information in the Android docs.
Steps:
-
Extract the downloaded files and move them to a permanent location, such as
~/.local/share/jdk
. -
Update your
.bashrc
file:.bashrc VERSION="18.0.2.1+1" JDK_PATH="$HOME/.local/share/jdk/jdk-$VERSION" export PATH="$PATH:$JDK_PATH/bin" export JAVA_HOME="$JDK_PATH"
-
Reload your shell:
source ~/.bashrc
Step 2: Install Android SDK Command-Line Tools
Instead of installing Android Studio, download the Command-Line Tools.
Steps:
-
Extract the tools and move them to
~/.local/share/android-sdk/cmdline-tools/latest
(ensure thebin/
inside directory is correctly placed). -
Update your
.bashrc
file:.bashrc ANDROID_SDK_PATH="$HOME/.local/share/android-sdk" export PATH="$PATH:$ANDROID_SDK_PATH/cmdline-tools/latest/bin" export PATH="$PATH:$ANDROID_SDK_PATH/platform-tools" export PATH="$PATH:$ANDROID_SDK_PATH/emulator" export ANDROID_HOME="$ANDROID_SDK_PATH"
-
Reload your shell:
source ~/.bashrc
-
Use the SDK manager to install essential components:
yes | sdkmanager \ "platform-tools" \ "emulator" \ "platforms;android-35" \ "build-tools;35.0.0" \ "system-images;android-35;google_apis_playstore;x86_64" yes | sdkmanager --licenses
You can change the version of the components to the one you need. Also keep in mind, that Flutter can later install other components during builds.
Step 3: Install Flutter SDK
Download the Flutter SDK from the official website.
Steps:
-
Extract the downloaded SDK to a directory like
~/.local/share/flutter
. -
Update your
.bashrc
file:.bashrc export PATH="$PATH:$HOME/.local/share/flutter/bin"
-
Reload your shell:
source ~/.bashrc
Step 4: Verify Your Installation
-
Check if Flutter and the Android SDK are correctly set up:
flutter doctor
-
Ensure that all dependencies are resolved.
Tips for Development
- Use VS Code with the Flutter extension for a lightweight and efficient setup.
- Regularly update your tools using
flutter upgrade
andsdkmanager
commands.
By following these steps, you can avoid the bloat of Android Studio and enjoy a streamlined development environment. If you encounter issues, feel free to comment or reach out!