Getting Flutter to Run on Ubuntu(and possibly other distros)
Recently I decided to dive back into flutter after taking a much needed hiatus from the slog of "learning to program for jobsss.." For development work I prefer a good Linux distribution, and after fighting with Elementary OS (and losing) to get even simple stuff working I decided to go back to Pop OS(on my desktop), and then Ubuntu(laptop).
This guide is to document the steps and issues I went through while trying to get Flutter going on Linux. Unfortunately, It's not as easy as it looks on Flutter's web page when it comes to our favorite penguin distro. Hopefully this helps get you up and running.
Step 1: install Ubuntu (or other distro). I'm not going to go through any of this, there's plenty of other guides out there for that.
- Download and install Android Studio. On Ubuntu, I installed the snap version right from the Ubuntu software store, but if you don't like snap you can install the standalone. The troubleshooting steps should be the same, as I have done it both ways on both Ubuntu and Pop OS.
download and install chrome. Flutter needs this installed, so suck it up and do it! You can go to https://www.google.com/chrome/ to get it.
install flutter. you can get flutter here. The easiest way to install it is to use snap:
$ sudo snap install flutter --classic
You can of course install it the manual way. The link above will have a walkthrough on that. Follow the steps in the Flutter guide to add Flutter to PATH.
-run flutter doctor and look at the errors.
$ flutter doctor
Now, depending on what order you did things, or if you ran into issues during your install before reading this guide, you might see several types of errors.
It might say you don't have Android Studio installed, even if you do, or you may just have an android studio error there and the rest green. Whichever you have, These next steps will hopefully clear those up for you.
Open android studio. If you haven't made a new project yet, You'll see something like this:
Up in the top right corner, you should see three dots. Click on them, and select SDK Manager from the list. If you have a project open, at the top select Tools and then find SDK manager in that list.
The screenshot above shows what you want to have checked. At the bottom, make sure you uncheck obsolete tools as some options may not be visible. Then make sure the ones that are checked match the ones in the screenshot. Hit apply and let everything install. Then back in the terminal, run flutter doctor again. You should see an error about licenses not being installed, so run
$ flutter doctor --android-licenses
At that point, you should be asked to start accepting the android licenses:
Hit yes and continue hitting 'y' until you get all the way through. Once everything finishes in the terminal, run flutter doctor one more time and you should see this:
Note: If for some reason You get some weird java errors when running the android licenses:
Make sure you check the box in the SDK Manager that says Android SDK Command-line Tools. Once that is installed those errors should go away.
That's it, your done! All that's left is to make a folder where you will store your projects, and generate your first one. Let me know if this guide helped in any way or if there were any errors and I'll do my best to fix them. Thanks for reading.