Skip to content

Instantly share code, notes, and snippets.

@joaquinicolas
Created December 15, 2021 02:59
Show Gist options
  • Save joaquinicolas/b7d0a0869485bca5156d0d4be87820f4 to your computer and use it in GitHub Desktop.
Save joaquinicolas/b7d0a0869485bca5156d0d4be87820f4 to your computer and use it in GitHub Desktop.
Setup flutter environment in arch linux
pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S flutter
java -version
sudo pacman -S jre8-openjdk
export JAVA_HOME='/usr/lib/jvm/java-8-openjdk'
export PATH=$JAVA_HOME/bin:$PATH
sudo groupadd flutterusers
sudo gpasswd -a $USER flutterusers
sudo chown -R :flutterusers /opt/flutter
sudo chmod -R g+w /opt/flutter/
yay -S android-sdk android-sdk-platform-tools android-sdk-build-tools
yay -S android-platform
sudo groupadd android-sdk
sudo gpasswd -a $USER android-sdk
sudo setfacl -R -m g:android-sdk:rwx /opt/android-sdk
sudo setfacl -d -m g:android-sdk:rwX /opt/android-sdk
sdkmanager --install "system-images;android-29;default;x86"
avdmanager create avd -n <name> -k "system-images;android-29;default;x86"
export ANDROID_SDK_ROOT='/opt/android-sdk'
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin/
export PATH=$PATH:$ANDROID_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/
flutter doctor --android-licenses
flutter create new_app
cd new_app
flutter run --debug
@baseplate-admin
Copy link

Hey would you mind fixing the indentation?

Instead of
flutter doctor --android-licenses

it should be
flutter doctor --android-licenses

@V3ntus
Copy link

V3ntus commented Aug 3, 2023

Cope. It's just whitespace

@guissalustiano
Copy link

guissalustiano commented Oct 24, 2023

Now you also need to install the android-sdk-cmdline-tools-latest and export to the $PATH before the platform-tools

export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ # <-- Before all
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin/
export PATH=$PATH:$ANDROID_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/

Also if you have another jdk installed, you may need to choose the jdk-8 with sudo archlinux-java set java-8-openjdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment