StoryboardWorkspaceArtscapeAbout

مجديد

HomeStoryboardWorkspaceArtscapeAbout

Installing Flutter & Android Studio on Linux

Installing Flutter & Android Studio on Linux

Wednesday, 4 Oct 2023


Hello guys, in this post, I'm going to share my experience installing Flutter on Linux. Flutter itself is a widget/component-based framework and is cross-platform, supporting Android, iOS, and web, using the same codebase. This method should be applicable no matter what distribution you use. In this case, the distribution I'm using is Garuda Linux, which is based on Arch. Okay, without further ado, here is the step-by-step installation of Flutter on Linux.

Install Android Studio

The first step I took was to install Android Studio, the purpose being to utilize the GUI-based SDK manager that is well-integrated within Android Studio. Because in Garuda Linux, I found it troublesome to maintain the Android SDK through the distribution's package manager (Pacman) to tweak permissions and environment paths. With Android Studio, issues like these should no longer exist.

Installing Android StudioInstalling Android Studio

Android Studio & SDK Manager

Okay, moving on after installing Android Studio, let's proceed to accept all the license agreements from Android Studio itself and simultaneously install the Android SDK through Android Studio. After it's done, don't close it yet; open the 'More SDK Manager'. Here, we'll check the emulator and the Android command line tools. Additionally, this step is optional, but we can also install a virtual disk to be run later through the emulator, or alternatively, prepare a native Android device to be used as a test subject through ADB.

open SDKopen SDK

Downloading Flutter

download flutterdownload flutter

To download the flutter, we can access this page to get a complete guide and get the tarball file of installation, but I will help explain it here. Yup, I don't use a package manager to install Flutter because when I checked, Flutter tends to create a cache in its own folder when running certain commands, and for some reason, it always fails to set permissions for Flutter in its base environment path. So for safety, I just downloaded the tarball file in my home directory like this. Next, I just need to extract it in "/home/username/Flutter".

extract flutterextract flutter

Setting Up Environment Variable

Next, we need to set up the environment variables so that every installed app can run properly. First, the env ANDROID_HOME, then Flutter as well, and lastly, this one is optional, for Flutter web development, by default, it will look for the base path of Google Chrome as its default browser. But you can use other Chromium-based browsers (for example, in my case, Brave Browser) by setting up the environment variables like this. Next, don't forget to log in, log out, or restart your Linux so that the environment variables are reloaded.

# ........some previous configuration

# taro ini dipaling bawah
export CHROME_EXECUTABLE=/opt/brave-bin/brave
export ANDROID_HOME=/home/$USER/Android/Sdk
export FLUTTER_HOME=/home/$USER/Flutter/bin
export PATH=$PATH:$FLUTTER_HOME

bash_profile.sh

Running "flutter doctor"

Before moving to the next step, ensure that flutter linceses has been agreed by using this command

flutter doctor --android-licenses

flutter lincensesflutter lincenses To check if all settings has been configured we can run this command in the terminal

flutter doctor

flutter doctorflutter doctor

By doing so the terminal will list the dependencies/requirements fulfilled by Flutter. If there are any that appear in red, perhaps something was missed during the setup of Flutter and Android Studio.

Opsional - Visual Studio Code Extension

This is optional, but I prefer using Visual Studio Code for Flutter development because it is lighter compared to Android Studio, since I don't use XML-based layouts, it's more like working with ReactJS component-based structure. So, I prefer using a regular code editor with ADB/emulator.

In the Visual Studio Code marketplace, there is a cool extension that can be installed to transform VS Code into a Flutter IDE. This way, you can run and debug the main.dart file using the code editor and it will detect the available virtual devices installed as well as the running ADB devices. You can check the extension here

flutter extensionflutter extension


Happy Fluttering

Phew, you made it to the end of this article. With this, Flutter should be ready for you to work on your cool projects out there. Don't forget to share this article if you find it helpful

~ Yazid


More of my story
Menyulap Lockcreen KDE Plasma menjadi seperti GnomeMenyulap Lockcreen KDE Plasma menjadi seperti Gnome
Menyulap Lockcreen KDE Plasma menjadi seperti Gnome

Saturday, 4 Nov 2023

Multiboot Live CD menggunakan VentoyMultiboot Live CD menggunakan Ventoy
Multiboot Live CD menggunakan Ventoy

Sunday, 5 Nov 2023

Software alternatif Windows di LinuxSoftware alternatif Windows di Linux
Software alternatif Windows di Linux

Thursday, 9 Nov 2023

Yazid Zaidan Mujadid

Software engineer who loves linux-distro and is a non-smoker (Yeah, get lost cigarettes!), enjoy drinking coffe matcha, can do a little art & design, currently fighting againts the stereotype of bad habits among programmers.

Contact

yazidzm.developer@gmail.com+62 895-3255-93165

Sitemap

All rights reserved © Yazid Zaidan Mujadid 2023