Related
I have a question so I think I dowlnloaded everything correctly but I still get this massage when I type in "flutter dictir" in cmd.
When I run "path/to/sdkmanager --install "cmdline-tools;latest" as recommended nothing happens.
So could you help me to download it anyways?
thecode
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
X cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more
! Doctor found issues in 1 category.
Open android studio then go to settings then SDK manager. Check the command line tools if it's not checked (most times it's not), then finish and let it download that plugin
Check the Android SDK path.
Go to where flutter is installed flutter config --android-sdk android_sdk_path
execute the command.
ex) flutter config --android-sdk C:\tools\AndroidSDK
Run this flutter config --android-sdk <path where you saved Android studio SDK> for e.g. in my case it was flutter config --android-sdk D:\AS_SDK (basically navigate SDK to the custom location).
Go to Android Studio, on the first page where you start a project, find the option to look for more settings, there you go to SDK manager and then select and install "Android SDK Command-line Tools (latest)" (size at the time of writing this is 108.9mb).
Now that you have the Android SDK navigated to the correct location and the latest command-line tools installed, run this flutter doctor --android-licenses and for every question it asks while confirming the licenses say "y".
Recently I upgraded my Mac to Catalina.
I installed Java, set JAVA_HOME to $(/usr/libexec/java_home) as per the documentation. I installed Android Studio and SDK tools and set the ANDROID_HOME variable to /Users/username/Library/Android/sdk.
I downloaded flutter, and added flutter/bin to my env variable $PATH, and when I run flutter doctor, it's running fine and giving me the results as expected, without all the features checked however as I am setting it up for the first time.
But when I run flutter doctor --android-licenses, it's giving me an error which says:
Android sdkmanager tool was not found, try re-installing or upgrading your Android SDK.
Run the command flutter upgrade.
Then run the command flutter doctor --android-licenses.
Actually it was the then latest version of Flutter 1.12.13+hotfix.8 installed, which was not reading the cmdline-tools folder from the latest Android SDK home.
Also to be on the safer side, just create a folder tools inside <path-to-sdk-home>, and copy the contents of <path-to-sdk-home>/cmdline-tools/latest/ to the folder <path-to-sdk-home>/tools/.
When I run flutter doctor command on mac its showing below, while I already install Android Studio, and I can run ios build from Android Studio.
[!] Android Studio (not installed)
flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.5 18F132, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[!] Android Studio (not installed)
[✓] Connected device (1 available)
In Windows
if your Android Studio install by default, you can use this command
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
after this command, flutter can found android studio, but the plugin can't...
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.48.0)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
In Linux (Ubuntu)
Note: for those who are facing the problem in Ubuntu and Android Studio is installed with snap:
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
Note: for those who are facing the problem in Ubuntu and Android Studio is installed with JetBrains Toolbox:
flutter config --android-studio-dir=/home/myuser/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882
Where ./201.7042822 matches the current version of Android Studio installed. You'll have to check which one you have and update it in the command above.
I had a similar issue which I solved by updating my flutter config as follows:
flutter config --android-sdk="$HOME/Android/Sdk"
flutter config --android-studio-dir="/usr/local/android-studio"
This was on Ubuntu 20.04.1
Assumptions:
You have extracted the downloaded android studio zip to /usr/local/android-studio
If you install Android studio using snap then
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
I solve this issue within windows 10 pro with this exactly line:
$> flutter config --android-studio-dir= "C:\Program Files\Android\Android Studio"
notice that is an space between the equal mark and the double cotes, this solve as you can see in this print
hope this help new flutter developers!
If you have installed Android Studio via Snap, run following command
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
This will fix the issue
flutter config --android-studio-dir C:\Program Files\Android\Android Studio will unfortunately not work because of empty space which breaks the tree structure but to solve the issue, use quotes like this: flutter config --android-studio-dir "C:\Program Files\Android\Android Studio"
A solution that worked for me was (after double clicking the downloaded file IDE) move the Android Studio program into the applications folder.
I ran Flutter Doctor and followed all prompts. worked for me.
This works on MacOS only
I think that I had the same issue, below are steps that helped me so I would recommend to try them.
1. Android Studio is installed and you can run it, so when it boots up, select configure:
In dropdown list open "plugins"
Search for "flutter" and install this plugin together with dart.
Restart the Android Studio and open a new terminal.
You should be able to create a flutter project in Android Studio and "flutter doctor" should work now.
Another possible solution:
Specify path, where android studio is installed, with the following command:
flutter config --android-studio-dir=
This worked for me!!
The problem is if your folder name is "Android Studio", flutter is not able to detect it later as taking only Android and skipping Studio.
Solution is :
Rename folder name from "Android Studio" To "AndroidStudio" and then run the config command :
flutter config --android-studio-dir="C:\Program Files\Android\AndroidStudio"
Following worked for me.
Close opened Android studio application if any, and open the cmd as an admisitrator and give the below command
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
This works for me in windows 8.1:
flutter config --android-studio-dir "C:\Program Files\Android\Android Studio"
2021.09.01
For ubuntu; in the unzip directory;
flutter config --android-studio-dir="pwd/android-studio"
command work for me.
Go Android studio Home Screen
Configure
Install Flutter, Dart, Plugin
Restart android studio and work properly
if now you are not able to solve the issue
so please run this command and check again
C:\mycomputer>flutter config --android-studio-dir="C:\ProgramFiles\Android\Android Studio"
I Have Solve this issue with this command
You can use below command in command prompt
flutter config --android-studio-dir=""
The solution with :
flutter config --android-studio-dir="Your_Android_Studio_Directory"
worked for me.
After that you can get error messages with flutter doctor even if you have the pluggins already intalled:
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
Reinstalling flutter and dart plugins in Android Studio (version 4.1) solved the problem.
Even though this question is for mac, a lot of people like me will find this as top result. So in case you are on Windows and you installed Android Studio via JetBrains Toolchain and the paths in answers above don't work for you, this worked for me
flutter config --android-studio-dir="C:\Users\YOUR_USERNAME_HERE\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\202.7351085"
Where 202.7351085 is the folder name for my current version of Android Studio so you may need to change that too.
If you can't find Android Studio in this path, do:
Search Android Studio and open file location
If it's a shortcut, open location again
You should be in /bin
Go up one folder and that's your path
Following worked for me in Windows:
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
flutter config --android-sdk="C:\%HOMEPATH%\AppData\Local\Android\Sdk"
Run
flutter config --android-studio-dir=<directory-where-studio-is-installed>
This will solve both issues of android licenses and studio not installed
For Linux (Ubuntu) users
Run
if you installed android studio through snap (Ubuntu Software application), run
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
Otherwise, run
flutter config --android-sdk="$HOME/Android/Sdk"
flutter config --android-studio-dir="/usr/local/android-studio"
Install Dart and Flutter plugins in Android Studio and then Restart
Switch to Flutter Beta Channel by running these commands
flutter channel beta
flutter upgrade
Run flutter doctor
The solution that worked for me is that I had to re-install AndroidStudio to a new location in a way that the full path to it contains no spaces, in the image below will you notice that flutter was cropping my full path because it contained a white space when I use the command flutter config --android-studio-dir C:\Program Files\Android\Android Studio
I had this problem because I downloaded a new AS version without uninstalling the old one first. During the download AS left the old program in place at C:\Program Files\Android\Android Studio and just created a new installation at C:\Program Files\Android\Android Studio1 (two installations next to each other??!! ).
I tried uninstalling AS (so I could do a fresh install) using the windows control panel but it said AS is already uninstalled?
So I had to run flutter config --android-studio-dir="C:\Program Files\Android\Android Studio1" to point to the new version i.e. Android Studio1. This solved the problem.
In my case just renamed from AndroidStudio to Android Studio.app inside app folder cuz it was searching for separated words: Android Studio. Worked like a charm
I faced the same problem and solved by configuring android studio path manually.
For my case the path was /opt/android-studio-4.1/android-studio
flutter config --android-studio-dir=/opt/android-studio-4.1/android-studio
on windows, just add the path C:\Program Files\Android\Android Studio, in the environment variables
I use WSL on Windows 10 and I think that I was configuring flutter from WSL's command prompt. When I cleaned the flutter repo and tried to configure everything from PowerShell as administrator, it worked.
On MacOS using Jetbrains Toolbox, I set it up as
flutter config --android-studio-dir "/Users/<myusername>/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app"
flutter config --android-studio-dir="file path of android studio"
for example :
in my case, my android studio in "E Drive "
flutter config --android-studio-dir="E:\Android\Android Studio"
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.
Flutter provides a command to update the Android SDK path:
Use :
flutter config --android-sdk <path-to-your-android-sdk-path>
Kindly first of all check your latest sdk
first step:
second step:
Now Run
run flutter doctor --android-licenses
Press Y against each agreement
run flutter doctor
it will work fine.
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.
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
In my SDK folder there were a empty folder (/build-tools/29.0.0)
I deleted it, and it worked fine
I spent a lot of time solving this.
Eventually what worked was going to project settings in android studio, sdk tools, uncheck hide obsolete packages and install sdk tools obsolete package.
Then run flutter doctor --android-licenses and then flutter doctor showed a green tick on my android toolchain.
Hope this helps someone.
For mac users,
It was working fine yesterday, now the hell broke. I was able to fix it.
My issue was with ANDROID_HOME
// This is wrong. No idea how it was working earlier.
ANDROID_HOME = Library/Android/sdk
If you did the same, change it to:
ANDROID_HOME = /Users/rana.singh/Library/Android/sdk
.bash_profile has
export ANDROID_HOME=/Users/rana.singh/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
If you don't find the proper SDK path then,
Open Android Studio
Go to Tools
Go to SDK Manager
You will find the "Android SDK Location"
Copy the path and edit "the Environment Variable"
After that, restart and run the command.
Then, run "flutter doctor"
Hope, it will work!
Flutter say Sdk build tool version(exp:android toolchain - develop for android devices (android sdk 28.0.3)) version=28.0.3
go to home/username/Android/Sdk/build-tools
delete this version(28.0.3) and fixed bug
To open Tools=> Android Sdk
Click SDK tools tab => check show package details and check all 28 SDK version
install that and to fix the issue
Flutter is designed to use the latest Android version installed. So if you have an incomplete download of the latest Android, Flutter will try to use that.
So either complete the installation or delete the complete installation. You can find the Android versions at: /home/{user}/Android/Sdk/platforms/android-29/android.jar
First open Android SDK Manager and make sure the required SDK's are installed.
Now open SDK manager, copy the SDK path. Open cmd
cd C:\Users\your-username\AppData\Local\Android\Sdk\build-tools
now again Change dir to the inner folder in build-tools.
check the presence or the name issues of the aapt.exe file.
I assume this is this known issue https://github.com/flutter/flutter/issues/13750
You need to fix the path to the SDK manually until this is fixed
in the file
my_flutter_project/android/local.properties
update
Add $ANDROID_HOME\sdk\tools and $ANDROID_HOME\sdk\platform-tools to the PATH environment variable.
For me, adding the Android SDK path didn't help.
I deleted all my SDKs (basically just deleted that Android folder. Used this path "C:\Users\your_user_name\AppData\Local\Android" to locate it.)
I then reinstalled all the required SDKs using android studio. (Be sure to install more than 1 SDK, I don't know why it doesn't work if you only install 1).
Then if I run Flutter Doctor, every thing works perfectly.
You have to set ANDROID_HOME variable to SDK.
Create a new variable by the name and set it to the installation directory.
Make sure SDK is not below 2 subfolders from c drive or any windows root drive.
I solved this problem by below step,
1) go to -> system environment -> Environment Variables -> system Variable
2) create New Variable Name ANDROID_HOME and Value D:\Androidsdk\tools (custom android sdk path).
3) concat this path D:\Androidsdk\platform-tools in Path variable value using ";". (also in system Variable)
4) that's all, Restart the PC to apply changes and try again -- flutter Doctor.
Flutter provides a command to update the Android SDK path:
flutter config --android-sdk < path to your sdk >
OR
If you are facing this issue --> sdk file is not found in android-sdk\build-tools\28.0.3\aapt.
You may have probably not installed build tools for this Api level, Which can be installed through this link https://androidsdkmanager.azurewebsites.net/Buildtools
This article explained how to solve it through Android Studio, since you don't need to install the SDK Manager separately when you use Android Studio.
REFERENCE: https://flutter-examples.com/flutter-command-line-tools-component-is-missing/
Open Android Studio
More Actions >>> SDK Manager
Android SDK >>> SDK Tools
Check "Android SDK Command-line Tools (latest) >>> OK
Restart your command line window and run flutter doctor again to verify
I don't have Android Studio installed, only VS Code and extract sdk in C:\Android\.
For solution, I'm set directly path:
flutter config --android-sdk "C:\Android\cmdline-tools\latest\bin"
First run flutter upgrade from your terminal ,
If you get the following error,
ANDROID_HOME = C:\Users\Name\AppData\Local\Android\sdk\Android
but Android SDK not found at this location.
First go to android studio, Settings->System Settings->Click the expand arrow
Then go to the Android SDK option and add the corresponding SDK to the project then go to Project Structure and add the respective SDK to the project Structure
Then run flutter upgrade in the terminal
We need to manually add the Android SDK. The instructions in the flutter.io/download say that the Android Studio 3.6 or later needs the SDK to be installed manually. To do that,
Open the Android Studio SDK Manager
In the Android SDK tab, uncheck Hide Obsolete Packages
Check Android SDK Tools (Obsolete)
Please refer the Android Setup Instructions.
What worked is Tools->Flutter->open Android module in Android studio, For me plugin flutter_email_sender was giving this error, so I copied local.properties file into it and the build become successful.
Or
Open Terminal
Run touch ~/.bash_profile; open ~/.bash_profile
export ANDROID_HOME=/Users/<macusername>/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/<macusername>/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Run source ~/.bash_profile in android studio terminal
This solved my issue.
Step 1: In search type show hidden files and enable it.
Step 2: Go to C directoy> users>
Step 3: In that navigate to AppData>Local>Android>Sdk
Step 4: Copy the path to this folder
Step 5: Open power-shell and type in:
flutter config --android-sdk "C:\Users\<folder under your name>\AppData\Local\Android\Sdk"
export ANDROID_HOME=$HOME/Development/android_sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/cmdline-tools
export PATH=$PATH:$ANDROID_HOME/build-tools
export PATH=$PATH:$HOME/pathto/flutter_sdk/bin
`PWD this won't work I guess
goes in .zprofile or .zshrc un the respective user directory of mac
go to local.properties in project/android/local.properties
change this
sdk.dir=C:\\Users\\ACER\\AppData\\Local\\Android\\sdk
to
sdk.dir=A:\\yoursdkfolder\\sdk
I tried the best answer but it didn't work for me.
Running flutter doctor-v gave me a tip that worked.
Just run flutter config --android-studio-dir=
It will ask you to restart VS Code again.
Delete the terminal in VS Code and restart VS Code.
Run flutter doctor-v again and the issues was sorted for me.
I tried many solutions and spent a lot of time then finally I removed the error by following steps-
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) X Android SDK file not found: C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3
delete this folder inside build-tools (because the error is not installed properly).
for resolving this issue, we have to uncheck all the latest plateforms (android (S)12 etc) and click apply after this restart the studio and check all these platforms again at least one latest and apply(ok).
Open Android Studio->files->Settings->Appearence & Behavior->System
Settings->Android SDK->SDK plateforms(Latest)
run flutter command to accept the licenses. (type Y then enter for all)
flutter doctor --android-licenses
run flutter doctor ( all is done).
Regards!
Dinesh Prajapati
I am using Visual Studio Code and Flutter 3.3.3. The above answers did not work for me. I followed the below steps to solve the problem:
Downloaded the latest Android command-line tools from https://developer.android.com/studio#command-tools
Unzipped the downloaded .zip file and went inside the extracted folder
Executed the below command in command-prompt (as administrator) to install the Android SDK packages:
bin\sdkmanager.bat --sdk_root=<android_sdk_path> "build-tools;28.0.3" "emulator" "platform-tools" "platforms;android-29" "tools" "cmdline-tools;latest" "system-images;android-29;google_apis_playstore;x86"
"system-images;android-29;google_apis_playstore;x86" is needed for
adding device emulator
Set the Android SDK path for flutter:
flutter config --android-sdk <android_sdk_path>
Accept the Android licenses for flutter:
flutter doctor --android-licenses
You are done. You can verify the installation using flutter doctor command. You should see something like this:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.3, on Microsoft Windows [Version 10.0.19044.2006], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.5)
[!] Android Studio (not installed)
[√] Connected device (3 available)
[√] HTTP Host Availability
! Doctor found issues in 1 categories.
I also have the same problem in windows, and It's come while authorizing android licenses. flutter doctor --android-licenseserror
for resolving this issue we only have to install Android SDK command-line Tools(Latest)
Open Android Studio->files->Settings->Appearence & Behavior->System Settings->Android SDK->SDK Tools->(install) Android SDK command-line Tools(Latest)
I have installed flutter through AUR. I also have aur/android-sdk 26.0.2-1 installed. When I run flutter run I get:
Warning! This package referenced a Flutter repository via the .packages file that is
no longer available. The repository from which the 'flutter' tool is currently
executing will be used instead.
running Flutter tool: /home/dair/.flutter-sdk
previous reference : /home/dair/flutter
This can happen if you deleted or moved your copy of the Flutter repository, or
if it was on a volume that is no longer mounted or has been mounted at a
different location. Please check your system path to verify that you are running
the expected version (run 'flutter --version' to see which flutter is on your path).
Unable to locate a development device; please run 'flutter doctor' for information about installing additional components.
Firstly, I ran flutter --version, and received:
Flutter • channel alpha • https://github.com/flutter/flutter.git
Framework • revision e2f54df5ab (9 days ago) • 2017-06-02 10:43:54 -0700
Engine • revision 1f2aa07571
Tools • Dart 1.24.0-dev.3.0
Not sure what exactly it means by "to see which flutter is on your path". Next I ran flutter doctor and got:
[✓] Flutter (on Linux, locale en_US.UTF-8, channel alpha)
• Flutter at /home/christopher/.flutter-sdk
• Framework revision e2f54df5ab (9 days ago), 2017-06-02 10:43:54 -0700
• Engine revision 1f2aa07571
• Tools Dart version 1.24.0-dev.3.0
[✗] Android toolchain - develop for Android devices
✗ ANDROID_HOME = /opt/android-sdk
but Android SDK not found at this location.
[✓] Android Studio (version 2.3)
• Android Studio at /usr/local/android-studio
• Gradle version 3.2
• Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] Connected devices
• None
However, if I cd into /opt/android-sdk I get:
➜ ~ cd /opt/android-sdk
➜ android-sdk ls
add-ons build-tools emulator platforms tools
So it looks like it is there. The closest question I could find is this one: React Native android build failed. SDK location not found but it seems to be using Mac as opposed to arch as well as some other differences. How can I resolve the flutter doctor and have my app run?
I was running with the same problem when I was trying the flutter doctor command:
The problem is a little clear, it's occurring because the flutter is not founding the path for your Android SDK.
There are two ways to solve it:
You can solve this issue setting only for your current terminal instance the SDK path with the following commands:
flutter config --android-sdk /path/to/android/sdk
flutter config --android-studio-dir /path/to/android/studio
Or to save it forever, exporting the ANDROID_HOME with your Android sdk path.
I solved it by exporting the ANDROID_HOME on my machine (Arch Linux, but this works for any Unix instance).
This will solve your issue, But you can need the sdk, platform-tools, tools and the ndk-build paths too (of course, everything needs to be installed first) on my profile file (in my case the .zshrc file, the same can be done on your .bashrc and etc.):
#SDK exporting - this will solve your issue
export ANDROID_HOME=/home/{user}/Android/Sdk
#Tools exporting - it can be need in your case
export PATH=/home/{user}/Android/Sdk/platform-tools:$PATH
export PATH=/home/{user}/Android/Sdk/tools:$PATH
export PATH=/home/{user}/Android/ndk-build:$PATH
#Flutter binary exporting
export PATH=/home/{user}/flutter/bin:$PATH
Then, I reloaded my profile file (that in my is the .zshrc file, use your file in your case .eg .bashrc):
source ~/.zshrc
After that, the flutter doctor will run properly.
If you're using Android Studio 3, you can configure your platform SDK by going to File -> Project structure and choose your platform SDK.
Hope this works for you.
I have solved this problem by the following command
flutter config --android-sdk <sdk-location>
Where is the location for your sdk. If you're on windows make sure to use double quotes.
For Windows:
Inside Android Studio,
get path from : Apprearance & Behaviour > System Settings > Android SDK > Android SDK path
Make sure your path does not contain any spaces in them, if you have edit path and re-install sdk to a different location.
After that,
flutter config --android-sdk {path}
flutter doctor --android-licenses
You are set!
To get the Android SDK path
- Open Flutter project in Android Studio
- Go to File > Project Structure > SDK Location. Copy the location
To set the Android SDK path
- Type in terminal flutter config --android-sdk /path/that/you/just/copied
i have solved!
i put my android SDK before in F:/androidsdk
so when i run "flutter config" android sdk doesnt linked.
To link flutter wiht android sdk just type command below:
flutter config --android-sdk /path/to/android/sdk
i just change with this
flutter config --android-sdk F:/androidsdk
i hope this is working.
I suffered alot trying to find a solution to it and finally I found the solution by configuring the project SDK
File -> Project structure then choose sdk platform.
Go to the project structure and make sure the sdk version is selected.
Flutter requires the Android SDK platform tools so that it can use the adb command line tool.
It looks like you've installed the Android SDK but you haven't installed the platform tools yet.
Here is the android-sdk-platform-tools Aur package for arch and a guide for how to install it.
Possibly the error message could be improved to indicate that we are actually missing the Android SDK platform tools rather than the Android SDK itself. If you want to, feel free to send a pull request or open an issue.
flutter config --android-studio-dir <path where android studio is installed>
In my case it was "C:\Program Files\Android\Android Studio"
try with double quotes in the command( I tried with double quotes, which might be necessary if there is space in the path)
Source: https://flutter.dev/docs/get-started/install/windows#android-setup
It is saying that your project is using two different path of flutter-sdk. There are two place where sdk paths are defined.
Setting (Setting > Language&Frameworks > Flutter > Flutter SDK path)
local.properties in your root folder
These both place should contain same path to sdk.Compile with flutter run !! done !!
The solution at https://github.com/flutter/flutter/issues/15114#issuecomment-376582281 worked for me, this worked after adding $ANDROID_SDK_PATH\platform-tools to user path variable.
I've set up my Android SDK manually on Windows 10 with the command line, I think this not change a lot in Linux, and I was able to solve this kind of errors while I tried to set up my development environment, if you want to solve it as I did, just follow the next steps that I posted in a GitHub Comment in a related issue:
https://github.com/flutter/flutter/issues/19805#issuecomment-478306166
I hope this can help anyone need it! Bye!
in environment variables
make
Variables: ANDROID_HOME
and add path of SDK get from
Andriod stideo --> settings --> SDK Coppy the Path examlpe
:C:\Users\Omar\AppData\Local\Android
Add the SDK path in variables Value: C:\Users\Omar\AppData\Local\Android
Next Step: Add 2 value in path variables :
%ANDROID_HOME%\tools
%ANDROID_HOME%\platform-tools
For macOS Catalina:
If you have installed android sdk to a custom location (say /Users/your_username/dev/android/sdk) then follow these steps (NOTE: You must change the location according to your sdk location):
Open zshrc file
nano ~/.zshrc
Add the following to the zshrc file
export ANDROID_HOME=Users/your_username/dev/android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export ANDROID_AVD_HOME=$HOME/.android/avd
Save and close nano using Ctrl+x, when prompted type y
Source your zshrc file using
source $HOME/.zshrc
You can check whether your problem is fixed by typing the following in a terminal window. You should get the sdk path as your output
echo $ANDROID_SDK_ROOT
For Windows 10 Version 2004
I added a user environment variable named ANDROID_HOME and value is {SDK-PATH}\build-tools\{SDK-VERSION}. You have to replace SDK-PATH and SDK-VERSION for your custom values.
And I appended another value named %ANDROID_HOME% to system PATH variable.
Then it worked as expected.
for me, it was very simple.
this kind of issue usually happens if IDE unable to load SDK.
so to solve this follow below steps:
goto file menu -> project structure -> project settings -> select "project"
now set Android SDK path with existing java version.
then select "modules" and configure Android SDK and click on apply and then click ok.
now we may find both ios and android emulators to run your flutter app on both devices.
You Can follow the first answer above. I would like to add a tip. If you are on windows and installed sdk on a path that requires admin rights to modify, then flutter doctor might fail to recognise the sdk. Copy the sdk folder to another non-admin location and then run flutter config --android-sdk command.
Windows command to fix SDK path
As mentioned above by others, using the below command works:
flutter config --android-sdk /path/to/android/sdk
Remember to put quotes in the /path/to/android/sdk
Example: flutter config --android-sdk "C:\Users\UserName\AppData\Local\Android\Sdk"
Under Windows 10 (without Android Studio) I noticed that folder 'sdk/build-tools' is empty. Then I solved this problem by executing:
sdkmanager build-tools;30.0.3
where 'build-tools;30.0.3' was obtained in an output of "sdkmanager --list >list.txt" command.
And, after build-tools's installation the error "Android SDK cannot be found by flutter" was solved too!
PS. It is absolutely essential to read carefully the documentation (there were although another mistakes by me)
PS.PS. The log (for illustration):
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.17763.1697], locale ru-UA)
[!] Android toolchain - develop for Android devices
X 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/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
X No valid Android SDK platforms found in d:/Android\SDK\platforms. Candidates were:
- android-13
- android-19
- android-23
- android-29
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
X android-studio-dir = d:\Android
X Unable to find bundled Java version.
[√] VS Code (version 1.53.1)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
C:\Users\Леон>sdkmanager build-tools;30.0.3
[=======================================] 100% Unzipping... android-11/renderscr
C:\Users\Леон>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.17763.1697], locale ru-UA)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
X android-studio-dir = d:\Android
X Unable to find bundled Java version.
[√] VS Code (version 1.53.1)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
C:\Users\Леон>
I had a similar error. Adding Flutter path of extracted flutter sdk till flutter fixed it
In my case, I have to accept the android licenses
run this command in the terminal or android studio terminal
flutter doctor --android-licenses
We need to fix this in the tool. You can work around this locally by running flutter config --android-studio-dir='C:\Program Files\Android\Android Studio' , which you can check with explorer. For me this path is C:\Program Files\Android\Android Studio\