Flutter does not find android sdk

179,279

Solution 1

Flutter provides a command to update the Android SDK path:

Use :

flutter config --android-sdk <path-to-your-android-sdk-path>

Solution 2

Kindly first of all check your latest sdk first step: install latest Sdk platform

second step: Install all these licenses

Now Run

run flutter doctor --android-licenses Press Y against each agreement

run flutter doctor flutter doctor it will work fine.

Solution 3

Choose the folder to install (I called it BASE_PATH) and use the following commands to install SDK with flutter:

Install SDK

cd $BASE_DIR
mkdir android-sdk
cd android-sdk
wget https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
unzip commandlinetools-linux-6200805_latest.zip
./tools/bin/sdkmanager --sdk_root=$(pwd) "build-tools;28.0.3" "emulator" "platform-tools" "platforms;android-28" "tools"

I used a separate folder for SDK, because it will add parent folders.

Install Flutter

cd $BASE_DIR
wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.8-stable.tar.xz
tar xvf flutter_linux_v1.12.13+hotfix.8-stable.tar.xz

Export Vars (you can add them to your .bashrc)

export ANDROID_SDK=$BASE_DIR/android-sdk
export ANDROID_PATH=$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
export FLUTTER=$BASE_DIR/bin
export PATH=$PATH:$ANDROID_PATH:$FLUTTER

Check!

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.12.13, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (not installed)
[✓] VS Code (version 1.31.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

Solution 4

I have got following issue on Flutter Doctor command.

X Android SDK file not found: ..\Android\sdk\platforms\android-28\android.jar.

to fix this just go to Tools=> Android Sdk =>Update Sdk Platform for which issue is there.(I installed SDK 28).

check flutter document for this issue

Solution 5

In my SDK folder there were a empty folder (/build-tools/29.0.0)

I deleted it, and it worked fine

Share:
179,279
Stein.
Author by

Stein.

Updated on January 17, 2022

Comments

  • Stein.
    Stein. over 2 years

    I just tried intalling flutter and since I already had android studio and the android sdk installed I just followed the installation of flutter. Here is my problem: When I run

    flutter doctor
    

    It tells me

      [√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version 10.0.16299.248], locale en-US)
        • Flutter version 0.1.5 at C:\Users\Name\git\flutter
        • Framework revision 3ea4d06340 (2 weeks ago), 2018-02-22 11:12:39 -0800
        • Engine revision ead227f118
        • Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
    
    [X] Android toolchain - develop for Android devices
        X ANDROID_HOME = C:\Users\Name\AppData\Local\Android\sdk\Android
          but Android SDK not found at this location.
    
    [√] Android Studio (version 3.0)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
    

    Which tells me that flutter is not finding my Android sdk (even though it is the path that android studio uses aswell - and android studio is working fine)

    I already tried reinstalling the sdk but it did not work.

    Im very thankful for any help with this.

  • Stein.
    Stein. about 6 years
    First of all thatks a lot for your anwer. I did not exactly understand where the local.properties folder is located.
  • Günter Zöchbauer
    Günter Zöchbauer about 6 years
    In you flutter project directors (my_flutter_project is the name I assumed) there is an android sub-directory that contains the file.
  • Stein.
    Stein. about 6 years
    I have only one flutter project created which only contains one directory (called .idea) which contains one xml file (called workspace). When I created this project in android studio there where no files to access.
  • Günter Zöchbauer
    Günter Zöchbauer about 6 years
    That dorsn't sound like you created it using flutter create. I guess you created it from the IDE and something went wrong. Can you try from command line?
  • Stein.
    Stein. about 6 years
    Yes I did create it in the IDE in the first place. Now I tried to create it using flutter creat - which finally worked. But when I run flutter doctor the same error message still appears. I also tried changing the local.proerties file. Ich changed the android sdk location to the location that my android sdk manager in android studio is using. Since android studio works I think that should work aswell. But the same error message still appears when I use flutter doctor and it does not find my smartphone when I try to run the flutter project.
  • Günter Zöchbauer
    Günter Zöchbauer about 6 years
    adb devices does list your device?
  • Stein.
    Stein. about 6 years
    I can run native android apps in my android studio with my smartphone - so i guess yes
  • Günter Zöchbauer
    Günter Zöchbauer about 6 years
    I guess it doesn't make sense to try anything like that as long as flutter doctor reports errors, but I'm out of ideas.
  • Stein.
    Stein. about 6 years
    Yes but I dont get why it tells me that it is not finding my sdk - since it is working with android studio and I even deleted it and re-downloaded it. The path is also the same that my newly downloaded sdk and android studio are using
  • Tony Lancer
    Tony Lancer over 5 years
    Your answer does not tell what a user should do. Your answer suggests that they should update all the SDK and tools according to your images.
  • Mustafamg
    Mustafamg about 5 years
    That works. Small addition. I found the sdk in the user folder of my windows 10 as follow : flutter config --android-sdk "C:\Users[your Local user folder]\AppData\Local\Android\Sdk"
  • Kasun Wanniarachchi
    Kasun Wanniarachchi about 5 years
    yes, you need to enter it with the quotes. eg: flutter config --android-sdk "C:\Program Files (x86)\Android\android-sdk"
  • Amresh Deshpande
    Amresh Deshpande over 4 years
    This worked for me on Mac machine. Simply delete empty folder. Thanks Xero
  • user3232196
    user3232196 about 4 years
    I'm not sure exactly which of these I performed that made flutter doctor finally prompt me to accept licences, but yes, now everything finally passes. I believe it may have been installing SDK platform api level 28, Android SDK tools (initial install only downloaded Platform-Tools. Once those were installed and I re-ran flutter doctor --android-licenses again, it all worked out. This process (to be able to develop Flutter) needs to be improved, imho. Is it worth the effort (rhetorical)?
  • Z Kubota
    Z Kubota about 4 years
    This issue is still not fixed, but I just ignored flutter-doctor and set up my Android Studio devices. Then I created the project from inside VSCode and everything seems to be working.
  • davyCode
    davyCode about 4 years
    Thanks. Somehow i skipped installing platform tool..worked thereafter
  • Murdock Helscream
    Murdock Helscream about 4 years
    Thanks a lot. After an hour of figuring out what's wrong finally works now!
  • SARAN SURYA
    SARAN SURYA over 3 years
    Man, Thanks a lot, it helped :)
  • html_programmer
    html_programmer over 3 years
    Why do we need to fix things that aren't wrong... can't they just add that statement during the setup? All those little things really annoy me.
  • html_programmer
    html_programmer over 3 years
    Another non-sensical thing... why is it active if then it doesn't work.
  • Lenny Kiano
    Lenny Kiano over 3 years
    Had almost given up on resolving the issue till I found this. Thanks. It works
  • Drdilyor
    Drdilyor over 2 years
    I had to do flutter config --android-sdk="$ANDROID_SDK" (github.com/flutter/flutter/issues/90042#issuecomment-919075‌​876) to make it work
  • Ojonugwa Jude Ochalifu
    Ojonugwa Jude Ochalifu over 2 years
    Finally, someone actually ANSWERED the question.
  • Rod Maniego
    Rod Maniego almost 2 years
    The accepted answer is particularly useful when android sdk was located somewhere other than the path specified in the flutter doctor error. By default, the answer above this comment should solve most android sdk issues with flutter. Keep sdk fully installed/updated as possible. Also, the accept licenses should be automatic.
  • Rod Maniego
    Rod Maniego almost 2 years
    The issue happens when the "latest" sdk platform found on the sdk directory was only partially installed or was incomplete and literally android.jar is not present. Make sure when you completely install any sdk platform for every new API you desire to use.
  • Rod Maniego
    Rod Maniego almost 2 years
    Yes, this works, and it will 'revert' to the next 'latest' API level present in the platform directory. It can be fully fixed by installing partially install sdk platform package again in the SDK manager.
  • Rod Maniego
    Rod Maniego almost 2 years
    This solves a different issue that might be found when command line tools is not present/not updated, but the question stated android studio (and sdk manager) was already installed.
  • ronit
    ronit almost 2 years
    just set the ANDROID_HOME env to appropriate location
  • ronit
    ronit almost 2 years
    thanks....the best answer over the internet just pass the --sdk_root flag with every sdk manager commmand , and after installing build tools and command liine tools, just set the ANDROID_HOME env flutter reads that only