`flutter doctor` report error `Android toolchain - develop for Android devices` - flutter

I run flutter doctor in my Mac:
there comes an issue below:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14 18A391, locale
zh-Hans-CN)
[✗] 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/setup/#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.
But I have installed Android SDK in my Mac this path /Users/delo/software/android-sdk-macosx.
before ask this question I have follow this post to add the /Users/delo/software/android-sdk-macosx in my /etc/paths.d/android-sdk file, and this post add path-to-android-sdk/tools and path-to-android-sdk/platform-tools.
but there is still have this issue.
EDIT-01
This is the echo $PATH:
/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/delo/.rvm/gems/ruby-2.3.3/bin:/Users/delo/.rvm/gems/ruby-2.3.3#global/bin:/Users/delo/.rvm/rubies/ruby-2.3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Users/delo/software/android-sdk-macosx:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/local/bin:/usr/local/mysql/bin:/usr/local/Cellar/go/1.7.6/bin:/Users/delo/.rvm/bin:/usr/local/sbin:/Users/delo/software/android-sdk-macosx/tools:/Users/delo/software/android-sdk-macosx/platform-tools

I see your $PATH have add the ANDROID SDK PATH and its tools and platform-tools PATH, but did not config the flutter PATH, but you can still run flutter doctor command, there should be copy error.
in your case, there must be ANDROID_HOME variable config error,
you should follow the correct way :
append the
export PATH=/path/to/your/flutter/bin:$PATH
export ANDROID_HOME="/path/to/your/android-sdk"
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
to
then you just source ~/.bash_profile.

I believe the problem is in the PATH of Android SDK Command-Line Tools and Android SDK Build Tools.
Put the lines at the end of the .bachrc file:
export ANDROID_HOME="/home/XXX/Android/Sdk/"
export PATH="$PATH:${ANDROID_HOME}cmdline-tools/latest/bin/:${ANDROID_HOME}build-tools/33.0.0/:${ANDROID_HOME}platform-tools/"
Note that latest and 33.0.0 must be changed according to your installation.

Related

Flutter 2.5 cannot recognise sdkmmnager, although everything was fine before upgrading

So yesterday i upgraded flutter to 2.5 and flutter doctor said android-licenses status unknown. So, I ran flutter doctor --android-licenses and it says that sdkmanager not found although the previous version which was probably 2.2.3 didn't say anything like that. I did not install cmdline-tools the "android studio" way. I followed a guide and downloaded the android cmdline-tools.zip file, unpacked it inside "android" folder, made a new tools folder (inside android folder) and copied everything from the android folder to the tools folder. Then I set path to sdkmanager, platform-tools and emulator.
After that I installed platform-tools 31.0.0, android-sdk 31.0.0 and an emulator. At that time flutter was able to recognise sdkmanager and it gave no errors. How do i solve this? Did something related to where the sdkmanager should be located change?
The output of flutter doctor:
[✓] Flutter (Channel stable, 2.5.0, on Arch Linux 5.13.13-zen1-1-zen, locale
en_IN.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for more
details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (1 available)
and the output of flutter doctor --android-licenses:
cmdline-tools are installed to resolve this.
Also i can run the default app just fine.
I am running linux.
For Windows, you can use this command:
flutter config --android-studio-dir="Path to your Android Studio"
Double check that inside Android Studio > SDK Manager > SDK Tools, Android SDK Command-line Tools are installed.

Flutter SDK got Permission deny in Parallels win10?

SDK path c:\sdk\flutter\bin
Project path C:\work\AutoDatas3\UI\auto_datas
I open the cmd with admin , an cd C:\work\AutoDatas3\UI\auto_datas
flutter run GOT:
flutter pub get:
拒绝访问:Permission Deny
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.21292.1000],
locale zh-CN)
[X] 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, please use
flutter config --android-sdk to update to that location.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (not installed)
[√] Connected device (2 available)
! Doctor found issues in 4 categories.
Just delete .package file which created by macos

"Unable to locate Android SDK. " while running flutter doctor on windows 10

currently my andoid studio is in location
C:\Android\AndroidStudio
on console
C:\Users\aditya jain>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19043.985], locale en-IN)
[X] 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, please use
`flutter config --android-sdk` to update to that location.
[√] Chrome - develop for the web
[√] Android Studio
[√] Connected device (2 available)
! Doctor found issues in 1 category.
my sdk location is
C:\Users\aditya jain\AppData\Local\Android\Sdk
1>i have installed Android sdk platform tools and Android sdk tools (obsoloete)
2>I only have a Local, Loacallow and Roaming File but not a Platforms file
, as i have seen many youtube videos ..they said to add to path platform file but i can't see any in my appdata folder in users(it is hidden by default).
https://www.youtube.com/watch?v=7GuGlATHYX8&t=195s
3> ran flutter config command for my sdk and got
C:\Users\aditya jain>flutter config --android-sdk flutter config --android-sdk \C:\Users\aditya jain\AppData\Local\Android\Sdk
Setting "android-sdk" value to "flutter".
You may need to restart any open editors for them to read new settings.
C:\Users\aditya jain>
Android SDK cannot be found by flutter
in this que there is an answer
to run
flutter config --android-sdk /path/to/android/sdk
flutter config --android-studio-dir /path/to/android/studio
but i don't know what i should for my sdk location ..i have less reputation so i can't comment there to ask there so here i am posting ques
also tried
C:\Users\aditya jain>flutter config --android-sdk <sdk-"C:\Users\aditya jain\AppData\Local\Android\Sdk">
The syntax of the command is incorrect.
C:\Users\aditya jain>flutter config --android-sdk <sdk-C:\Users\aditya jain\AppData\Local\Android\Sdk>
The syntax of the command is incorrect.
as is suggested in same que ans but getting this given above
(i know my path contain spaces ..i tried to put my android in downloads so that there will be no spaces but there also i get errors as below
C:\Users\aditya jain>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19043.985], locale en-IN)
[X] 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, please use
`flutter config --android-sdk` to update to that location.
[√] Chrome - develop for the web
[!] Android Studio
X android-studio-dir = C:\Android\AndroidStudio
X Android Studio not found at C:\Android\AndroidStudio
[√] Connected device (2 available)
! Doctor found issues in 2 categories.
C:\Users\aditya jain>flutter config --android-studio-dir=C:\Users\aditya jain\Downloads\Android\AndroidStudio
Setting "android-studio-dir" value to "C:\Users\aditya".
You may need to restart any open editors for them to read new settings.
C:\Users\aditya jain>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19043.985], locale en-IN)
[X] 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, please use
`flutter config --android-sdk` to update to that location.
[√] Chrome - develop for the web
[!] Android Studio
X android-studio-dir = C:\Users\aditya
X Android Studio not found at C:\Users\aditya
[√] Connected device (2 available)
! Doctor found issues in 2 categories.
C:\Users\aditya jain>
i can't rename ' aditya jain' folder to 'adityajain'...it takes space....pls help mee.
please help and thanks community!!
If the path name has spaces, you can wrap the path with double quotes. This allows Windows to identify the path as a single String: "C:\Users\aditya jain\Downloads\Android\AndroidStudio"
If you have already configured SDK path for Flutter (flutter config --android-sdk ) and yet not working than...
Install the platform-tools resolves the problem.
Go to the SDK Manager (top-right in the toolbar), then open SDK Tools, then check-mark ✅ Android-SDK Platform-Tools and apply the changes (As shown below).
For me this solution worked.
Enjoy...
Check image

android-studio android-studio-dir location

I am trying to get flutter/android studios to work on linux and i am having an issue getting flutter to recognize my android-studio location.
I am able to run android-stuio, but when i try to tell flutter my install location via the android-studio-dir param i get something that doesn't work.
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.27.0-2.0.pre.78, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio
✗ android-studio-dir = ~/Downloads/android-studio/bin/
✗ Android Studio not found at ~/Downloads/android-studio/bin/
[✓] VS Code (version 1.53.1)
[!] Connected device
! No devices available
At location ~/Downloads/android-studio/bin/ i have the bin directory of my android studio install. This obviously doesn't work.
I have tried to look up what directory android-studio-dir needs to point at and it seems that i wants to point at a directory like /path/to/android/studio.
but in my install directory i dont have a studio directory to point at?
So my question is what should android-studio-dir point at?
I am able to run android studio by ./~/Downloads/android-studio/bin/studio.sh
So i am fairly confident i have android studio "installed" correctly.
For windows the commands are same like those from #Doc but take care of the slashes:
flutter config --android-sdk="C:/TestFolder/AndroidSDK"
flutter config --android-studio-dir="C:/Program Files/Android/Android Studio"
the commands are
flutter config --android-sdk="/home/user/Android/Sdk"
flutter config --android-studio-dir="/usr/local/android-studio"
Don't use the bin folder, just mark the root folder for both the sdk and the IDE. Also, use complete path.
A. To resolve your unrecognized sdk. issue, use following steps
Find your dir. location. You will find at same place
C:\users\UserName\AppData\Local\Android\SDK
Mine was at
C:\Users\SHARM\AppData\Local\Android\Sdk
Go to PowerShell and type
flutter config --android-sdk
"C:\users\UserName\AppData\Local\Android\SDK"
Change your Username above
PowerShell screenshot showing how I resolved unable to locate SDK issue
B. To resolve dir issue, type
flutter config --android-studio-dir "type directory name"
In my case, it was
flutter config --android-studio-dir "C:/Program Files/Android/Android Studio"
C. I have license issue so I am sharing here if in case you encounter it after fixing SDK and dir issue.
C.1 Open you Android Studio
C.2 On main screen, Click Advanced > SDK Manager
SDK Manager
C.3 Select SDK Tools
Check Android SDK Command-line tools and click ‘apply’.
Check Android SDK Command-line tools and click ‘apply’
C.4 Click Apply.
C.5 Your license issue will be resolved. You can test it by again going to PowerShell and type
flutter doctor
You will pass all tests like I did in photoflutter passed all tests
If you want to check your configurations for SDK, dir etc, just type flutter config and it will show you all configurations.

flutter run -bash: Desktop/flutter/bin/flutter: No such file or directory

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.14.6 18G103, locale pl-PL)
[✗] 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.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[!] Android Studio (not installed)
[!] Connected device
! No devices available
I created a my_app folder and typed:
cd my_app
flutter run
The "flutter run" command does not work. How to fix this?
Have you installed android sdk?
If not then installing Android Studio will will install all the required dependencies.
I faced this problem it easy to solve
Open Android Studio
And go to preference
Plugins
Download flutter & dart
You need Android SDK, if you plan on using Android Studio then SDK will be downloaded with the Android Studio
https://developer.android.com/studio is the link to download