Solving Flutter Doctor Issues on Ubuntu 21.04

 

Some of flutter doctor issues


If you are having following issues with flutter doctor then read further. I have had these issues and it took sometimes for browsing stockoverflow and going through trial and error.

BTW I installed the snap version of Android Studio and Flutter.

Basically I got following issues:

  • Android Studio not found
  • Missing android toolchain and android licences
  • Not being able to find android licenses

Install Android SDK command-line tools

Android Studio Settings

This is the first solution. In my case the Android SDK command-line tools were not selected and installed. After installing it, the android toolchain issue and android licenses are gone. When I ran flutter doctor afterwards, there was a step to review of android licenses.

Adjust the PATH

This is the second solution for the error Android Studio (not installed). I added the following lines in .profile file in my home directory:

ANDROID_SDK_ROOT=$HOME/Android/Sdk
FLUTTER_SDK=$HOME/snap/flutter/common/flutter
ANDROID_HOME=/snap/android-studio/current/android-studio
JAVA_HOME=/snap/android-studio/current/android-studio/jre
 
export PATH="$ANDROID_HOME:$JAVA_HOME:$FLUTTER_SDK:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/tools/bin:$PATH"

That's all. Happy coding!