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".
Android toolchain - I develop for Android devices (Android SDK version 30.0.3):
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.
The solution for me was opening Android Studio and going to SDK Manager, switch to the SDK Tools tab and check Android SDK Command-line Tools (latest).
Don't forget to add to your PATH the tools and platform-tools folder that are inside your SDK.
Android SDK Manager screenshot on Windows
Please see the attached screenshot for installing tools from SDK Manager.
Since my Android Studio starting screen looks different from the answers above I want to share my solution:
Open Android Studio and click on 'more actions' on the welcome screen.
Click on 'SDK Manager'
In the '*Preferences' window go to the '*SDK Tools•' tab
Select the 'Android SDK Command-line Tools (latest)' checkbox.
Click on 'Apply'.
Open SDK Manager from your Android Studio.
SDK Tools tab
Check Android SDK Command Line Tools as in the picture
Apply.
Then again run flutter doctor.
My solution process is as follows:
~/Library/Android/sdk/tools/bin/sdkmanager --install "cmdline-tools;latest"
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 5 more
Install Android SDK Command-line Tools in Android Studio:
Preferences → Appearance & Behavior → System Settings → Android SDK → SDK Tools → Android SDK Command-line Tools (latest)
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
[✓] Connected device (2 available)
• No issues found!
For Windows users
If you still see the same error even after your build tools, tools are installed and added to the user/system path variable, and maybe your sdkmanager location is really not found
Just type in
flutter config --android-sdk "C:\Users\{Your_User_Name}\AppData\Local\Android\Sdk" # (Default SDK location)
Add the path inside "" to where your Android SDK folder is located
Then you can run the licenses to verify any license which is not approved.
This worked for me.
Your Android SDK version requires an update.
Open Android Studio → click Android Studio on the top bar → Preferences → Appearance & behavior (click to open the dropdown) → System Settings (click to open the dropdown) → Android SDK → SDK Tools (tab).
Check Android SDK Command-line Tools (latest) → Apply → click OK. Once the update has finished, run flutter doctor.
Screenshot of the Appearance & Behavior menu
If what flutter doctor said was something like:
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/<admin>/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
The path/to/sdkmanager for me was:
/Users/<user>/Library/Android/sdk/tools/bin/sdkmanager
So what solved the whole thing for me was running:
/Users/<user>/Library/Android/sdk/tools/bin/sdkmanager --install "cmdline-tools;latest"
For macOS, I ran this command;
cd ~/Library/Android/sdk/tools/bin
./sdkmanager --install "cmdline-tools;latest"
Then when I ran the flutter doctor command again, it confirmed that the problem was solved.
Easiest solution:
Open Android Studio and click settings in the upper left corner of Android studio.
Search for "SDK tools" in the search box.
From the SDK tools just check the Android SDK Platform Tools.
Run flutter doctor to verify. You can also restart Android Studio if you want.
I hope the problem will be solved.
For macOS users:
flutter config --android-sdk "/Users/{YOUR_USER_NAME}/Library/Android/sdk"
Then
flutter doctor --android-licenses
Type "y" for all stops.
I solved this problem on Windows 10 with the following actions:
Run the following command in a Windows command prompt or Flutter console:
flutter config --android-sdk "C:\Users\'your computer name' AppData\Local\Android\Sdk"
(you may need to find and enter your own SDK path)
The Android SDK location could be found in the Android Studio application* → Appearance & Behavior → System Settings → Android SDK
Open your Android Studio, and then → File → Settings → Appearance & Behavior → System Settings → Android SDK → SDK Tools → download Android SDK Command-line Tools (latest) and you are good to go.
If you have already downloaded cmdline-tools and the Android SDK, make sure Flutter isn't looking in the wrong directory with:
flutter config --android-sdk=""
If you are a Mac user, just open your terminal and paste:
cd Library/Android/sdk/tools/bin./sdkmanager --install "cmdline-tools;latest"
And hit Enter.
This command will install the latest version of cmdline-tools.
Then, run flutter doctor, and the error will be gone.
For Linux (Ubuntu)
Just copy this command in your terminal and change 'your user name' with your user name without spaces:
/home/your user name/Android/Sdk/tools/bin/sdkmanager --install "cmdline-tools;latest"
You have to install Android SDK Command-line Tools.
To do that, invoke the menu command File → Settings → Android SDK and download the latest.
You must choose Android SDK on the left side of the Settings window. It’s under Appearance & Behavior → System Settings.
I installed the Android SDK platform tool from Android Studio. This helped me to resolve this error.
Error before installation
Installed platform tool from Android Studio
After installation of Platform tools
This is for Windows:
If you are still facing the issue even after installing the "Android SDK Command-line Tools(latest)" thru Android Studio -> Settings->Appearance & Behavior -> Systems Settings -> Android SDK -> SDK Tools, You need to configure the flutter for Android SDK Path (Not the environment variable path).
Android SDK Will be installed under Program files e.g. (C:\Program Files (x86)\Android\android-sdk). If not this location, find out the location where it is installed and go to the bin folder (C:\Program Files (x86)\Android\android-sdk\cmdline-tools\7.0\bin) and run
flutter config --android-sdk "C:\Program Files (x86)\Android\android-sdk"
After this run flutter doctor, now this issue should be resolved.
If you have installed the latest cmd-line tools from Android Studio, but it still gives the error, then you should do the following.
If you have installed the Android SDK to a custom directory, then you need to copy the path of your SDK folder. Then you have to go to the edit environment variable, click New give
a variable name: ANDROID_SDK_ROOT. And a variable value: path of your SDK folder.
Click OK.
In the older version of Flutter, this error came with the solution (creating ANDROID_SDK_ROOT), but in the new versions it does not show that.
For MacOS Users
If already have android studio installed simply run:
flutter config --android-sdk "/Users/$USER/Library/Android/sdk" & flutter doctor --android-licenses
For me, running this command worked perfectly:
flutter config --android-sdk /path/to/your/sdk
I got 3 errors while installing flutter :
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Android Studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
I can install plugin(s) in android studio but how to resolve android licenses problem , I ran "flutter doctor --android-licenses" it shows all the licenses how to know which license is not accepted and how to resolve it
Thanks in advance
Its very simple to install flutter, just you have to follow some steps.
The first and foremost thing, you need to have a OS (LINUX, MAC, WINDOWS) and a editor.
If you are using Linux as OS and Android studio/ intellij platform, you can proceed with below mention steps.
1.1. setup an editor, i would prefer android studio.
1.2. Start Android Studio.
1.3. Open plugin preferences (Preferences > Plugins on macOS, File > Settings > Plugins on Windows & Linux).
1.4. Select Browse repositories, select the Flutter plugin and click Install.
1.5. Click Yes when prompted to install the Dart plugin.
1.6. Click Restart when prompted.
Next, install flutter SDK,
2.1. goto ths link : https://flutter.io/docs/get-started/install/linux
here you will find the flutter stable version as a .tar.gz, download this to your download folder(ex.)
2.2. open terminal paste this: tar xf ~/Downloads/flutter_linux_v1.0.0-stable.tar.xz
2.3.press enter. It will extract and make a folder name "flutter"
note*: that folder is installation folder, if you delete this, your flutter installation is gone, you need to reinstall (step 2.1, 2.3)
2.4 Add the flutter tool to your path: (paste in terminal)
export PATH="$PATH:pwd/flutter/bin"
This command sets your PATH variable for the current terminal window only. To permanently add Flutter to your path
2.5 write in terminal: flutter doctor
it will show some infos, scroll down, it will show the require things needed.
for my case, i had to install this: sudo apt-get install lib32stdc++6
and accepted the licenses : flutter doctor --android-licences
Next, open android studio, make new project
3.1 Select File > New Flutter Project.
3.2 Select Flutter application as the project type, and press Next.
3.3 Make sure that the Flutter SDK Path text field specifies the location of the SDK.
3.4 Enter a project name (for example, myapp), and press Next.
3.5 Click Finish.
Then you are done :)
For other platforms, the basic installation idea is same as this, you can go through the flutter official doc.
Did you complete the additional task to be completed as reported with flutter doctor command?
Could we see the full output from flutter doctor and flutter doctor --android-licenses respectively?
See Run flutter doctor section under Get Started: Install.
after making sure you've updated your sdk
and installed flutter and dart plugin
restart your Android studio then run in order
flutter doctor
then
flutter doctor --android-licenses
then press yes
If flutter doctor --android-licenses don't work then I would recommend to export to java 8 instead of java 10. It worked for me
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\