A simple, fast and lightweight Flutter dev environment on Manjaro
If you need a lightweight installation for your setup, then you’re at the good place.
Here we are going to see how to make that works only with the basics.
What we are going to use to develop our apps:
- Flutter SDK
- VSCode
- Android SDK (only cmdline-tools, no need Android Studio, no thanks)
- A cheap laptop, a device and an USB cable.
We are not using android emulator here, since it eats our RAM. We want it simple, so we’re using our device instead.
So the first thing you need to do is download the Flutter SDK and just install the basics for flutter. No need to install Android Studio.
So by “basic” I mean, you need to extract the file somewhere on your system then do something like that:
export PATH=/the/bin/folder:$PATH
Ok then. If you run flutter doctor now, you should see that flutter is already there, but we have a lot of errors. We are going to fix it right away.
Go to the official Android Studio download page and scroll down to “Command line tools only” section. Download the linux version.
Then follow these sequences:
- Extract the files on some /android folder
- Create a folder “latest” inside the folder /android/cmdline-tools
- Copy all the files into the “latest” folder
- Add the bin folder to the PATH environment variable:
export PATH=/path/to/android/cmdline-tools/latest/bin:$PATH
5. List and install other sdk tools using the sdkmanager:
sdkmanager --list
sdkmanager "platform-tools" "platform;android-30" "build-tools;30.0.3"
6. Set the ANDROID_HOME environment variable (the root. a folder before cmdline-tools):
export ANDROID_HOME=/path/to/android
7. Set the Android SDK folder on Flutter’s configuration:
flutter config --android-sdk /path/to/android
8. Accept the android licenses
flutter doctor --android-licenses
9. Enable the USB debugging on your device and connect it to your machine
10. Normally you’re all set. Just run the flutter doctor to validate it
flutter doctor
If you’re having trouble with java version, try this:
11. Install java-8-openjdk (or any other compatible version) — it also works with java-11-openjdk
sudo pacman -S jre8-openjdk-headless jre8-openjdk jdk8-openjdk openjdk8-src
12. Switch back to java 8 (or any other compatible version)
sudo archlinux-java set java-8-openjdk
Expected output
If you don’t have something like that, please comment below.