Installing Android Studio on WSL2 for Flutter

January 4, 2022 7 By addshore

I’m trying to do some “modern” Android development and want to experiment with Flutter while running Windows, and WSL2 with Ubuntu.

Flutter isn’t as easy to install as some programs, no simple apt-get etc, but instead a collection of binaries distributed by different organizations that all need to be tied together.

To start with, you’ll want to read Installing Flutter 2.0 on WSL2 by Josh Kautz. This can guide you through getting Flutter and also the Android SDK with some copy & paste commands.

This post is inspired by these simple steps there to make this easy for folks to copy for Android Studio.

Install Android Studio

Create a Downloads directory if it doesn’t already exist, and navigate to it.

mkdir -p $HOME/Downloads && cd "$_"Code language: PHP (php)

Download Android Studio for Linux. You’ll find the Linux download somewhere on the page. (Right-click the download button and select “Copy link address” to copy the address of the archive.)

wget language: JavaScript (javascript)

Create an Applications directory if it doesn’t already exist, and navigate to it.

mkdir -p $HOME/Applications && cd "$_"Code language: PHP (php)

Extract the Android Studio files from the archive to the Applications directory.

tar xfv $(ls -1t $HOME/Downloads/android-studio-* | head -n1)Code language: JavaScript (javascript)

Configure flutter to use this installation

flutter config --android-studio-dir $HOME/Applications/android-studio/Code language: PHP (php)

Running flutter doctor should no longer find issues

I couldn’t find an executable to add to PATH, but you can create an alias

alias android-studio=$HOME/Applications/android-studio/bin/studio.shCode language: PHP (php)

And then run the studio