Installing Android Studio on WSL2 for Flutter
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 https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2020.3.1.26/android-studio-2020.3.1.26-linux.tar.gz
Code 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.sh
Code language: PHP (php)
And then run the studio
android-studio
After running android-studio I get. .
!bootstrap.error.title.startup.error!
!bootstrap.error.message.no.graphics.environment!
This looks like the graphics support for WSL is not working or set up.
Take a look at https://docs.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
Thementioned link about flutter and android sdk is not available.
Thanks! I tweeted the author https://twitter.com/addshore/status/1560591725436866560
Unfortunately I can’t find an archived link for the page content, but will update the post if one appears
The link in the post is now updated!
https://joshkautz.medium.com/installing-flutter-2-0-on-wsl2-2fbf0a354c78
[…] Installing Android Studio on WSL2 for Flutter (🆕new in 2022) […]
[…] Installing Android Studio on WSL2 for Flutter (again #1 ➡️) […]