Unable to locate android SDK for flutter doctor
Asked Answered
A

8

8

I have tried uninstalling and reinstalling flutter on my computer twice but whenever I run flutter doctor in the terminal I am still met with the following error.

[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
  Install Android Studio from:
  https://developer.android.com/studio/index.html
  On first launch it will assist you in installing the Android SDK
  components.
  (or visit https://flutter.dev/docs/get-started/install/macos#android-setup
  for detailed instructions).
  If the Android SDK has been installed to a custom location, set
  ANDROID_SDK_ROOT to that location.
  You may also want to add it to your PATH environment variable.

Does anyone know how to fix this problem? Also, could this be the reason that none of my emulators are running my app? Thanks, and sorry, I am still new to Flutter and android studio.

Arelus answered 21/6, 2020 at 19:27 Comment(0)
E
14

If it is unable to locate your Android SDK, the reason might be that your Android SDK path is not up to date.

I think your issue is similar to this: https://github.com/flutter/flutter/issues/45007.

Try flutter config --android-sdk <path-to-your-android-sdk-path> to update the Android SDK path.

Endothelioma answered 21/6, 2020 at 19:51 Comment(2)
How do I find the path to my Android SDK, what is the name of that file? what is the file type?Arelus
In Android Studio, open your SDK Manager. A window pops up and there is a line which says: Android SDK Location: ... This is your path to your SDK.Endothelioma
S
3

This issue is related to environment variables.

After entering the environment variables, you have to click on the system variables and find the "Path" variable.

Double click on the "Path" variable and add a new one on the right.

There are two directories you need to add, "D: \ AndroidSDK \ platforms" and "D: \ AndroidSDK \ platform-tools".

These two directories can be in different places, remember this.

Seligman answered 21/6, 2020 at 19:54 Comment(2)
Can you explain where I would do this at? Am I doing this in Android Studio? Sorry, I am very new to this. Any screenshots would be extremely helpful!Arelus
Look at this video it will help you. youtube.com/watch?v=4iZW9-D_JhUSeligman
P
2

If you do for example:

flutter config --android-sdk C:\Users\User\AppData\Local\Android\Sdk

and nothing happen, it is normal you have to double backslash like this:

flutter config --android-sdk C:\\Users\\User\\AppData\\Local\\Android\\Sdk
Pompei answered 19/1, 2022 at 16:20 Comment(0)
R
1

Faced the same issue when I moved my android studio to my external hard drive on my MacBook, here are steps I followed to fix

1 set the andriod sdk path flutter config --android-sdk example: flutter config --android-sdk /Volumes/Apps/Library/Android

Once done it showed another error: Android license status unknown. to fix this we need to add andriod studio directory, that is android studio app. Like this: flutter config --android-studio-dir example: flutter config --android-studio-dir /Volumes/Apps/Android\ Studio.app

finally access the licensed from android studio, using below command and your are done. flutter doctor --android-licenses

Rafael answered 14/1, 2021 at 10:1 Comment(0)
U
0

For flutter 10.2.3 and Android Studio Bumblebee, I had to uninstall sdk using

File -> Settings > Appearance & Behavior -> system Settings -> Android SDK > SDK Platforms > uncheck all and apply.

After uninstall, I had remove to remaining contents in the Android SDK location manually.

Then install again

File -> Settings > Appearance & Behavior -> system Settings -> Android SDK > SDK Platforms > Check Android API 32 -> apply

Install in SDK Tools tab -> expand Android SDK Build Tools -> 32.0.0 and Android Command Line tools (latest)

Then set

flutter config --android-sdk "path to your sdk root"

Undercool answered 20/3, 2022 at 13:24 Comment(0)
S
0

In my experience, flutter doctor reported an issue and failed to locate Android sdk (even having specified sdk path with flutter config --android-sdk) also if there is a problem with any platform or build tool installed.

In my case the correct build-tools for my platform was missing and after installing it with sdkmanager also the issue related to sdk path in flutter doctor disappeared.

My working android sdk configuration (based on Android platform 30) is:

  Path                 | Version | Description                    | Location            
  -------              | ------- | -------                        | -------             
  build-tools;30.0.3   | 30.0.3  | Android SDK Build-Tools 30.0.3 | build-tools/30.0.3  
  emulator             | 31.3.11 | Android Emulator               | emulator            
  patcher;v4           | 1       | SDK Patch Applier v4           | patcher/v4          
  platform-tools       | 33.0.3  | Android SDK Platform-Tools     | platform-tools      
  platforms;android-30 | 3       | Android SDK Platform 30        | platforms/android-30

Hope this helps anyone facing the same problem, having set the correct path to android sdk

Stifle answered 6/10, 2022 at 10:57 Comment(0)
K
0

For more clarity on how to add the path

Run this for adding to path,

flutter config --android-sdk "path to your sdk root"

Example

flutter config --android-sdk "/Users/clovisokonkwo/androidSdk"

Then this for accepting license

flutter doctor --android-licenses
Know answered 8/1, 2023 at 8:24 Comment(0)
S
0

I had two major issues: sdkmanager couldn't be found in terminal and Flutter didnot show Android SDK

So for first issue: I made sdkmanager available. I downloaded unzipped android commandlinetools-linux-11076708_latest.zip in to my defined path

cd ~/Development/Android/Sdk

this is path you'll extract

unzip ~/Downloads/commandlinetools-linux-11076708_latest.zip

made a new folder inside cmdline-tools and moved into it, such that:

~/Development/Android/Sdk/cmdline-tools/tools/ (bin and other content)

now added it to the $PATH

kwrite ~/.bashrc

#add it to .bashrc

export ANDROID_HOME=$HOME/Development/Android/Sdk
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin:$PATH

Doing this made my sdkmanager available in terminal. try:

which sdkmanager

It should give the path.

Now the Second issue: Flutter Didnot show Android SDK for it i ran

flutter config --android-sdk=/home/leezannn/Development/Android/Sdk

and need to install other sdk-packages

sdkmanager "build-tools;34.0.0" "platforms;android-34" "platform-tools" "cmdline-tools;latest"

check and specify the versions yourself with

sdkmanager --list | grep build-tools

Now run flutter doctor --android-licenses and pressed y to everything.

You can See the specific problem by running

flutter doctor -v
Specialize answered 19/4, 2024 at 4:5 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.