39

I have installed flutter correctly on my Ubuntu machine. I have also installed Android Studio and its plugins Flutter and Dart. Anyway, when I run:

flutter doctor --verbose

I get this output:

[✓] Flutter (Channel stable, 1.20.1, on Linux, locale es_ES.UTF-8)
    • Flutter version 1.20.1 at /root/snap/flutter/common/flutter
    • Framework revision 2ae34518b8 (hace 5 días), 2020-08-05 19:53:19 -0700
    • Engine revision c8e3b94853
    • Dart version 2.9.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at /home/AAAA/Android/Sdk
    • Platform android-30, build-tools 30.0.1
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_265-8u265-b01-0ubuntu2~18.04-b01)
    • All Android licenses accepted.

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup
      for detailed instructions).

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

My android studio is located on /snap/android-studio/current/android-studio I have also tried running:

flutter config --android-studio-dir=/snap/android-studio/current/android-studio

And:

flutter config --android-studio-dir=/snap/android-studio

But the result after running flutter doctor is always the same, nothing recognized.

Thanks!

7
  • try to restart android studio with invalidate & restart :) Commented Aug 11, 2020 at 10:20
  • And what dir should I use: /snap/android... or /snap/android-studio/current/android-studio? Commented Aug 11, 2020 at 10:26
  • after restart try flutter doctor again :) also see one stackoverflow.com/a/60699554/8388068 github.com/flutter/flutter/issues/27283 github.com/flutter/flutter/issues/9991 Commented Aug 11, 2020 at 10:28
  • sorry, but maybe I should set the --android-studio-dir to default? Commented Aug 11, 2020 at 10:30
  • check my above comment i give you some links that might help you Commented Aug 11, 2020 at 10:31

7 Answers 7

56

I installed both flutter and android-studio through snap. This fixed it for me:

flutter config --android-sdk="$HOME/Android/Sdk"
flutter config --android-studio-dir="/snap/android-studio/current/android-studio/"
Sign up to request clarification or add additional context in comments.

2 Comments

I was almost losing hope until I found your comment and decided to try your approach. It worked. Thank you!
ubuntu snap installed android studio Kaola (not the latest) for me. Your scripts didn't work for me. which android-studio showed: /snap/bin/android-studio should I change to that path?
16

The flutter config command above also worked for me on Windows, but instead I had to use it with no spaces bewtween equal sign and "Path", like below:

flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"

1 Comment

try also escaping backslashes ("\\" instead of "\") in the above example, if the above doesn't work. note also that android SDK is not installed automatically with the initial Android Studio setup - you have to run Android Studio for the first time, and it will then download the SDK for you. I am not sure if setting --android-sdk is necessary once it is installed (usually in c:\Users\{user}\AppData\Local\Android\Sdk folder on Windows)
15

it's work for me, macos:

flutter config --android-studio-dir=/Applications/"Android Studio.app"

Updated on 2/2024:

If you are using Android Studio Preview, pls use:

flutter config --android-studio-dir=/Applications/"Android Studio Preview.app"

Comments

11

when flutter doctor not detect android studio ;

then provide path manually by using following command :

flutter config --android-studio-dir ="your-android-path"

for example:

flutter config --android-studio-dir = "C:\Program Files\Android\Android Studio"

it's work for all OS .

thank you...

2 Comments

Thnaks man, but the command should not include these many spaces, it should be flutter config --android-studio-dir ="your-android-path"
flutter config --android-studio-dir "C:\Program Files\Android\Android Studio" this command worked for me.. have to remove =
5

flutter wasn't detecting android studio till i did this command:

flutter config --android-studio-dir=/media/hacker/code/android/android-studio

instead of this below which did not work

flutter config --android-studio-dir="media/hacker/code/android/android-studio"

Comments

1

I'm using the Jetbrains toolbox on Mac OS.

  • Under "Android Studio" I chose ... Settings
  • I copied the "Install Location"
  • I then used the command
flutter config --android-studio-dir "#PATH_TO_INSTALL#/Android Studio.app"

Comments

0

Yeah, so find where snap has installed Android-Studio in your ubuntu:

  1. Go to the root directory where you can find etc, opt, var, usr directories.

  2. Search for "Android". For me it was in "/opt/android-studio-2021.2.1/android-studio"

  3. Open the Terminal and enter:

    flutter config --android-studio-dir ="your-android-path" 

    For me it was like:

    flutter config --android-studio-dir ="/opt/android-studio-2021.2.1/android-studio" 
  4. Then again run:

    flutter doctor 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.